-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
[Regression] - ModuleNotFoundError: when running production build (and eating underlying error) #22200
Comments
It looks like that this error is a regression coming from webpack : webpack/webpack#8538 |
@gfortaine im sure it’s related to this #21679 (comment) |
@jasonwilliams Many thanks 👍 We do confirm that by setting the following in // next.config.js
module.exports = {
future: { webpack5: true }
} the bug disappears with next 10.0.6 in your test repo : https://github.com/gfortaine/nextjs9-typescript-server-vscode-example/tree/moduleNotFound |
@timneutkens I understand webpack 5 support is “beta” but was there a reason to make such a breaking change on a patch release? The documentation hasn’t been updated to mention the change in how you opt in (it still only mentions resolutions) so this would have broken for anyone using webpack 5 with plugins. I only found that fix by chance on another issue. I’m not the first person to raise this as a problem (this issue comes top when searching Webpack 5 and next, it would be worth putting something here for those who fall into this problem) @gfortaine thanks for testing |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
What version of Next.js are you using?
10.0.7 (Issue looks like it was introduced in 10.0.6)
What version of Node.js are you using?
15
What browser are you using?
Chrome
What operating system are you using?
MacOS
How are you deploying your application?
next start
Describe the Bug
Updating to Webpack 5.21.2 alongside Next 10.0.6 causes ModuleNotFound errors when using ignorePlugin.
We don't get the error when rolling back to 10.0.5
When building in development
next
we have no issues with our pages.however when running
next build
we get an error:Issue 1: underlying error was eaten
The above wasn't very helpful as it doesn't tell me what caused it or what was trying to be loaded.
I managed to search for the
ModuleNotFoundError
class and log out the error before it.It was in
/node_modules/next/dist/compiled/webpack/bundle4.js
Now i can see:
Issue 2: null being passed to webpack/ignorePlugin
It looks like in production next passes
null
to ignorePlugin, specifically here.Im not sure why this only happens on production builds but it seems to have only happened since updating to webpack 5
Expected Behavior
production builds should work
To Reproduce
moduleNotFound
branchyarn next build
(fails)The text was updated successfully, but these errors were encountered: