Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack 5: Cannot find module 'webpack/lib/RuleSet' #437

Closed
kamilmielnik opened this issue Mar 1, 2021 · 3 comments · Fixed by #440 or CollageLabs/collagelabs.org#482 · May be fixed by navikt/engangsstonad#715
Closed

Webpack 5: Cannot find module 'webpack/lib/RuleSet' #437

kamilmielnik opened this issue Mar 1, 2021 · 3 comments · Fixed by #440 or CollageLabs/collagelabs.org#482 · May be fixed by navikt/engangsstonad#715

Comments

@kamilmielnik
Copy link

kamilmielnik commented Mar 1, 2021

Do you want to request a feature, report a bug or ask a question?

Bug

What is the current behavior?

I'm getting the following error when using webpack 5:

./src/icons/download.svg
Error: Cannot find module 'webpack/lib/RuleSet'
Require stack:
- /home/kamil/projects/cv/node_modules/svg-sprite-loader/lib/utils/get-matched-rule-4.js
- /home/kamil/projects/cv/node_modules/svg-sprite-loader/lib/utils/get-matched-rule.js
- /home/kamil/projects/cv/node_modules/svg-sprite-loader/lib/utils/index.js
- /home/kamil/projects/cv/node_modules/svg-sprite-loader/lib/configurator.js
- /home/kamil/projects/cv/node_modules/svg-sprite-loader/lib/loader.js
- /home/kamil/projects/cv/node_modules/next/dist/compiled/webpack/bundle4.js
- /home/kamil/projects/cv/node_modules/next/dist/compiled/webpack/webpack.js
- /home/kamil/projects/cv/node_modules/next/dist/server/hot-reloader.js
- /home/kamil/projects/cv/node_modules/next/dist/server/next-dev-server.js
- /home/kamil/projects/cv/node_modules/next/dist/server/next.js
- /home/kamil/projects/cv/node_modules/next/dist/server/lib/start-server.js
- /home/kamil/projects/cv/node_modules/next/dist/cli/next-dev.js
- /home/kamil/projects/cv/node_modules/next/dist/bin/next

What is the expected behavior?

No error.

If the current behavior is a bug, please provide the steps to reproduce, at least part of webpack config with loader configuration and piece of your code.

  1. Clone this repo: https://github.com/kamilmielnik/cv
  2. Checkout this commit: kamilmielnik/cv@747bd11
  3. npm install
  4. npm run dev or npm run build

Please tell us about your environment:

  • Node.js version: 12.18.0
  • webpack version: 5.24.2
  • svg-sprite-loader version: 5.2.1
  • OS type & version: Ubuntu 20.04

Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

Not sure if it has anything to do with me using Next.js, but things broke when I upgraded it from 10.0.2 to 10.0.7.
Installing webpack explicitly didn't help.
But this workaround fixes it: kamilmielnik/cv@d01d007

d3x42 pushed a commit that referenced this issue Mar 6, 2021
Webpack versions util cause some troubles, so this fix should cover them

BREAKING CHANGE:
delete get-webpack-version.js

ISSUES CLOSED: #437, #417
@d3x42
Copy link
Contributor

d3x42 commented Mar 6, 2021

I'm working on a fix, please try [email protected]

@rumsky
Copy link

rumsky commented Mar 9, 2021

Same issue on webpack 4.44.1

@kamilmielnik
Copy link
Author

@d3x42 I confirm that [email protected] fixes the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment