css-loader, postcss-loader: Module build failed: Error: No configuration provided for

4.5k views Asked by At

I got a new computer and tried to open an older project but I keep getting this error whenever I run development and I just don't understand why. The project fully works on my old pc.

I tried updating all devdependencies or just the css-loaders but neither worked. And I do have a postcss config file, tried to update stylelint too.

this is the github

ERROR in ./~/css-loader?{"importLoaders":1}!./~/postcss-loader!./src/css/style.css
Module build failed: Error: No configuration provided for /Users/hoyhym/Desktop/test/src/css/style.css
    at module.exports (/Users/hoyhym/Desktop/test/node_modules/stylelint/lib/utils/configurationError.js:8:27)
    at stylelint._fullExplorer.load.then.then.config (/Users/hoyhym/Desktop/test/node_modules/stylelint/lib/getConfigForFile.js:39:13)
 @ ./src/css/style.css 4:14-142 13:2-17:4 14:20-148
 @ multi (webpack)-dev-server/client?http://localhost:3000 webpack/hot/dev-server ./~/react-dev-utils/webpackHotDevClient.js ./src/css/style.css ./src/js/script.js
1

There are 1 answers

4
Vlatko Vlahek On

I had the same problem a few days ago. It seems that this issue can pop up depending on where exactly is your webpack config stored inside the project, or where exactly you are calling the webpack command from.

Try adding the options: config: path inside your 'postcss-loader'

          use: [
            { loader: 'css-loader', options: { importLoaders: 1 }},
            { loader: 'postcss-loader', options: { config: { path: './postcss.config'}}}
          ]