-
-
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
Web worker inside npm package built with parcel #3959
Comments
Parcel will automatically parse |
Same |
Can someone provide a code sample where this fails? Seems to work for me in a simple example. (@lgarron ?) |
https://github.com/lgarron/parcel-2-web-worker-package-import
I can publish more package versions with other combinations of workarounds. :-P |
In particular, note that this is required for (Also note that the current implementation is not Windows-compatible, because I hard-coded the slash direction. There would normally be another level of abstraction for cross-platform |
For what it's worth, I'd be happy to drop CJS support and just publish/consume: new Worker(new URL("./worker.js", import.meta.url)); Which I think should stay intact when building a library target, but would be appropriate for Parcel to compile to non-ESM code for browser targets while Firefox and Safari still don't support module syntax for workers. (Browsers that syntax error if I don't know any remotely reasonable way to publish a CJS build with worker instantiation code that works in |
Ok, so all of that should be covered by #5430 |
Not necessarily related, but as a heads up to anybody who finds this and it is not already obvious to, you need
See here: |
Hey how I can embed web workers inside a npm package. The problem Im facing is when I import my npm package for a demo it is trying to dowload the web worker from the public path of the dev server which does not exists
The text was updated successfully, but these errors were encountered: