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

Fails with future.webpack5 option, unless webpack explicitly installed #34

Open
lunelson opened this issue May 24, 2021 · 3 comments
Open

Comments

@lunelson
Copy link

On startup with a new Next.js project (v10.2.2) configured with this plugin, and with the next.config.js using the future.webpack5 option in order to enforce webpack 5 (usually it falls back to webpack 4 if a custom webpack config is detected, as is the case with this plugin), the dev command fails with the following message.

The message goes away if I explicitly install webpack to the project.

...
info  - Using webpack 5. Reason: future.webpack5 option enabled https://nextjs.org/docs/messages/webpack5
Error: Cannot find module 'webpack/lib/dependencies/ConstDependency'
Require stack:
- /Users/lunelson/Git/sandboxes/nextjs-preactx-test/node_modules/@prefresh/webpack/src/index.js
- /Users/lunelson/Git/sandboxes/nextjs-preactx-test/node_modules/@prefresh/next/src/index.js
- /Users/lunelson/Git/sandboxes/nextjs-preactx-test/node_modules/next-plugin-preact/index.js
- /Users/lunelson/Git/sandboxes/nextjs-preactx-test/next.config.js
- /Users/lunelson/Git/sandboxes/nextjs-preactx-test/node_modules/next/dist/next-server/server/config.js
- /Users/lunelson/Git/sandboxes/nextjs-preactx-test/node_modules/next/dist/server/next.js
- /Users/lunelson/Git/sandboxes/nextjs-preactx-test/node_modules/next/dist/server/lib/start-server.js
- /Users/lunelson/Git/sandboxes/nextjs-preactx-test/node_modules/next/dist/cli/next-dev.js
- /Users/lunelson/Git/sandboxes/nextjs-preactx-test/node_modules/next/dist/bin/next```
@lunelson lunelson changed the title Fails with future.webpack5 option, unless I specifically install webpack Fails with future.webpack5 option, unless webpack explicitly installed May 24, 2021
@aralroca
Copy link

I have the same issue with webpack 5

@aralroca
Copy link

Installing webpack to the project solve it... npm i webpack@latest --save-dev

@laymonage
Copy link

preactjs/prefresh#361 and preactjs/prefresh#362 have been merged and have solved the issue, but I had to manually upgrade @prefresh/webpack to fix it. Maybe @JoviDeCroock could bump the prefresh in this package again? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants