webpack-contrib / postcss-loader

PostCSS loader for webpack
MIT License
2.86k stars 211 forks source link

ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): #669

Closed g-rusev closed 8 months ago

g-rusev commented 11 months ago

Bug report

Actual Behavior

Minimal test repository: https://github.com/g-rusev/postcss-error

Environment:

OS: Windows 10 Pro, 64 bit, 21H2 NodeJS: version 20.4.0

When using the POSTCSS-LOADER version 7.3.3 build fails with the error:

ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):

When the version in the package.json is set to:

"postcss-loader": "7.0.2"

build succeeds.

To summarize:

The same code base in the test repo:

when build with "postcss-loader": "7.0.2" - succeeds when build with "postcss-loader": "7.3.3" - fails

Expected Behavior

It should build with the latest version of POST CSS LOADER with no errors.

How Do We Reproduce?

  1. Download the test repo.
  2. Run npm i to install dependencies.
  3. Run npm run dev to start the build. The build will fail with errors.

Please paste the results of npx webpack info here, and mention other relevant information

image

alexander-akait commented 8 months ago

Sounds like cosmiconfig is using private methods... Please check your Node.js version twice, because 20.4.0 supports them, I can't reproduce the problem locally using your repo, try to run node --version, maybe you have two version Node.js (for example some developers use nvm to switch between different Node.js version), anyway we can't fix it here, sorry, but feel free to feedback