webpack/postcss-loader

Configuration file .config/postcssrc reading priority issue

Closed this issue Β· 1 comments

Why should we prefer reading the /.config/postcssrc file under the system root directory rather than the ~/.config/postcssrc file under the current user's home directory

Bug report

ant-design-pro@6.0.0 start
cross-env UMI_ENV=dev max dev

πŸ˜„ Hello PRO
https://umijs.org/docs/guides/routes
Mako https://makojs.dev is a new fast Rust based bundler from us, which is heavily optimized for umi and much faster than webpack. Visit https://makojs.dev/docs/getting-started#bundle-with-umi for more details if you want to give it a try.
Using openapi Plugin
info - Umi v4.3.27
info - Preparing...
╔════════════════════════════════════════════════════╗
β•‘ App listening at: β•‘
β•‘ > Local: http://localhost:8000 β•‘
ready - β•‘ > Network: http://192.168.0.5:8000 β•‘
β•‘ β•‘
β•‘ Now you can open browser with the above addresses↑ β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Module build failed (from ./node_modules/@umijs/bundler-webpack/compiled/mini-css-extract-plugin/loader.js):
HookWebpackError: Module build failed (from ./node_modules/@umijs/bundler-webpack/compiled/postcss-loader/index.js):
Error: EACCES: permission denied, open '/.config/postcssrc'
at tryRunOrWebpackError (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:77383:9)
at webpack_require_module (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62253:12)
at nested_webpack_require_153795 (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62210:18)
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62281:20
at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40417:9)
at done (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40459:9)
at Hook.eval [as callAsync] (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), :15:1)
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62188:43
at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40414:9)
at timesSync (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:39229:7)
at Object.eachLimit (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40395:5)
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62153:16
at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40417:9)
at timesSync (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:39229:7)
at Object.eachLimit (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40395:5)
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62121:15
at symbolIterator (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40417:9)
at done (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:40459:9)
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:62068:8
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:60547:32
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:77363:3
at _done (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), :9:1)
at Hook.eval [as callAsync] (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), :39:22)
at Cache.store (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52335:20)
at ItemCacheFacade.store (/mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52538:15)
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:60547:11
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52313:6
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52267:11
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:97633:9
at /mnt/soft/antd-test/node_modules/@umijs/bundler-webpack/compiled/webpack/index.js:52316:6
at eval (eval at create (/mnt/soft/antd-test/node_modules/@umijs/bundler-utils/compiled/tapable/index.js:1:7682), :30:1)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
-- inner error --

Actual Behavior

Priority was given to reading /.config/postcssrc, which does not exist, then read ~/.config/postcssrc

Expected Behavior

should first read~/.config/postcssrc, if it doesn't exist, then read /.config/postcssrc

How Do We Reproduce?

mkdir -p /.config/postcssrc
sudo chmod 700 /.config

Due to this - https://github.com/cosmiconfig/cosmiconfig?tab=readme-ov-file#explorersearch, that is how cosmiconfig works and it was discussed a lot of time in their repo, we can't control this here

Feel free to feedback