After upgrading postcss-loader from 6.2.1 to 7.3.3, Webpack build failed because I have a file in my project root called .config, and no PostCSS specific config outside of my main Webpack config. After adding an empty postcss property in package.json, the problem ceases.
N.B. Not sure if this is specific to these mentioned postcss-loader versions. I'm guessing it has to do with the associated upgrade of cosmiconfig from 7.0.1 to 8.2.0.
Actual Behavior
Output on Webpack build, without postcss entry in package.json or any PostCSS specific config file:
ERROR in ./assets/css/style.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
HookWebpackError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: ENOTDIR: not a directory, open '/home/klaatu/kod/edu-lms/.config/postcssrc'
at tryRunOrWebpackError (/home/klaatu/kod/edu-lms/node_modules/webpack/lib/HookWebpackError.js:88:9)
at __webpack_require_module__ (/home/klaatu/kod/edu-lms/node_modules/webpack/lib/Compilation.js:5067:12)
at __webpack_require__ (/home/klaatu/kod/edu-lms/node_modules/webpack/lib/Compilation.js:5024:18)
at /home/klaatu/kod/edu-lms/node_modules/webpack/lib/Compilation.js:5095:20
at symbolIterator (/home/klaatu/kod/edu-lms/node_modules/neo-async/async.js:3485:9)
at done (/home/klaatu/kod/edu-lms/node_modules/neo-async/async.js:3527:9)
at Hook.eval [as callAsync] (eval at create (/home/klaatu/kod/edu-lms/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at /home/klaatu/kod/edu-lms/node_modules/webpack/lib/Compilation.js:5002:43
at symbolIterator (/home/klaatu/kod/edu-lms/node_modules/neo-async/async.js:3482:9)
at timesSync (/home/klaatu/kod/edu-lms/node_modules/neo-async/async.js:2297:7)
-- inner error --
Error: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
Error: ENOTDIR: not a directory, open '/home/klaatu/kod/edu-lms/.config/postcssrc'
at Object.<anonymous> (/home/klaatu/kod/edu-lms/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].use[1]!/home/klaatu/kod/edu-lms/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].use[2]!/home/klaatu/kod/edu-lms/node_modules/resolve-url-loader/index.js!/home/klaatu/kod/edu-lms/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].use[4]!/home/klaatu/kod/edu-lms/assets/css/style.scss:1:7)
at /home/klaatu/kod/edu-lms/node_modules/webpack/lib/javascript/JavascriptModulesPlugin.js:452:10
at Hook.eval (eval at create (/home/klaatu/kod/edu-lms/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
at /home/klaatu/kod/edu-lms/node_modules/webpack/lib/Compilation.js:5069:39
at tryRunOrWebpackError (/home/klaatu/kod/edu-lms/node_modules/webpack/lib/HookWebpackError.js:83:7)
at __webpack_require_module__ (/home/klaatu/kod/edu-lms/node_modules/webpack/lib/Compilation.js:5067:12)
at __webpack_require__ (/home/klaatu/kod/edu-lms/node_modules/webpack/lib/Compilation.js:5024:18)
at /home/klaatu/kod/edu-lms/node_modules/webpack/lib/Compilation.js:5095:20
at symbolIterator (/home/klaatu/kod/edu-lms/node_modules/neo-async/async.js:3485:9)
at done (/home/klaatu/kod/edu-lms/node_modules/neo-async/async.js:3527:9)
Generated code for /home/klaatu/kod/edu-lms/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[6].use[1]!/home/klaatu/kod/edu-lms/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[6].use[2]!/home/klaatu/kod/edu-lms/node_modules/resolve-url-loader/index.js!/home/klaatu/kod/edu-lms/node_modules/sass-loader/dist/cjs.js??ruleSet[1].rules[6].use[4]!/home/klaatu/kod/edu-lms/assets/css/style.scss
1 | throw new Error("Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):\nError: ENOTDIR: not a directory, open '/home/klaatu/kod/edu-lms/.config/postcssrc'");
@ ./assets/ts/entrypoints/base.ts 1:0-30
Expected Behavior
.config being a file instead of a directory should not cause the build to fail IMO, even if no higher priority config files exist.
How Do We Reproduce?
Install Webpack with postcss-loader 7.3.3 with cosmiconfig 8.2.0. Make .config a file. Try to build.
Please paste the results of npx webpack info here, and mention other relevant information
Bug report
After upgrading postcss-loader from 6.2.1 to 7.3.3, Webpack build failed because I have a file in my project root called
.config
, and no PostCSS specific config outside of my main Webpack config. After adding an emptypostcss
property inpackage.json
, the problem ceases.N.B. Not sure if this is specific to these mentioned postcss-loader versions. I'm guessing it has to do with the associated upgrade of cosmiconfig from 7.0.1 to 8.2.0.
Actual Behavior
Output on Webpack build, without
postcss
entry inpackage.json
or any PostCSS specific config file:Expected Behavior
.config
being a file instead of a directory should not cause the build to fail IMO, even if no higher priority config files exist.How Do We Reproduce?
Install Webpack with postcss-loader 7.3.3 with cosmiconfig 8.2.0. Make
.config
a file. Try to build.Please paste the results of
npx webpack info
here, and mention other relevant information