-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Workers don't work in library mode #6261
Comments
I am using an import in my web worker. With some experimenting, I tried changing `"browserslist" to "> 10%" (instead of "> 0.2%"). After doing this, the error message is more explicit, pointing at the import statement in the web worker. When I take that import statement out (replacing with an empty function for the moment), it builds. |
With some experimenting, I have found that:
and not having an
|
I have solved this. It turns out that I was missing The way to create a new web worker that will allow me to
I will still leave this open as a bug, as there was no indication of this in the error message and I had to spend a fair amount of time just trying different things to come to this realization. The error message
does not tell me anything about the Worker needing to be of type module. Hopefully leaving this issue open in the meantime will help anyone else who is stuck on this. |
I'm not sure if this is helpful, but I have found that this is only an issue for The build succeeds if I do:
Regardless though, the resulting build cannot execute, as described here: Still, I hope this is a helpful clue. |
I'm not getting |
Hey, thank you for confirming that workers in library mode are broken. I was having a tough time last week trying to understand what I was doing wrong, but it really helps to simply know that this is not possible at the moment. Hopefully, this thread will save someone else some time if they are trying to bundle a library that uses them. For the time being, we will do without web workers. |
Also, I should note that the It seemed to always build with |
🐛 bug report
I recently updated my project to use a worker:
When I import the package from another package in the monorepo with
parcel serve
, things work as expected.However, when I
parcel build
the package, this happens:I am not targeting
browser
in my package.json.It is not clear if this is an actual bug, or a misunderstanding on my part, but the error message is not clear anyway.
But, if I remove the line about the worker, it builds.
🎛 Configuration (.babelrc, package.json, cli command)
babel.config.json:
package.json (just the relevant parts)
🤔 Expected Behavior
parcel build
should successfully build, just like it does when there is no web worker. Or at least, the error message should be clearer.😯 Current Behavior
💁 Possible Solution
Not sure
🔦 Context
This is blocking me from building a project that uses a worker.
💻 Code Sample
🌍 Your Environment
The text was updated successfully, but these errors were encountered: