-
Notifications
You must be signed in to change notification settings - Fork 27.8k
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 error (MODULE_NOT_FOUND) for with-web-worker example #22096
Comments
I just tried to add the My theory is that Next.js comes with its own version of Webpack as it is not directly listed in a project's My workaround (only very briefly tested) is to manually add Webpack as dev dependency:
|
Installing webpack as an dependency gives a different error:
Returns a the following error:
Which seems to be a common error for next.js projects trying to use workers Using worker-plugin 5.0
gives the same error:
|
Looks like a bug or breaking change in Next.js version 10.0.6 to me. I have tried a range of versions all the way up from 9.3 and the example stops working with 10.0.6. It seems there were quite a few Webpack related changes in 10.0.6. A simple downgrade to 10.0.5 (or earlier) appears to work. |
Duplicate of #21679 |
This does not seem like a duplicate. That issue was fixed by removing old plugins that are not required anymore. Your own example of using webworkers does not work. |
While this isn't the answer most are looking for -- my problem was solved by moving to webpack 5 with it's native web worker support: next.config.js module.exports = {
future: {
webpack5: true
}
} some.js const worker = new Worker(new URL("./worker.js", import.meta.url));
// use worker |
That generates the following warning during development:
And breaks in a production build:
|
Good spot, I hadn't tested a production build yet (and I tolerate the development warning, but maybe that foreshadows the production issue). So looks like there are some more kinks left with web workers, webpack 5, and next.js (this issue and then using wasm in web workers (#22581)) |
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 example does this report relate to?
with-web-worker
What version of Next.js are you using?
10.0.6
What version of Node.js are you using?
14.3.0
What browser are you using?
N/A
What operating system are you using?
Ubuntu 20.04
How are you deploying your application?
N/A
Describe the Bug
Unable to build:
Expected Behavior
For the example to build
To Reproduce
yarn create next-app --example with-web-worker with-web-worker-app cd with-web-worker-app/ yarn dev
The text was updated successfully, but these errors were encountered: