Closed panda-madness closed 3 years ago
Webpack now supports the following syntax for address this, which is the right way to load a Worker with a relative path in a module in a browser, as well:
const worker = new Worker( new URL( './worker.js', import.meta.url ) );
It would be nice if the plugin supported this notation, as well.
that's also the recommended way of dealing with web workers in snowpack https://github.com/snowpackjs/snowpack/issues/1280
This plugin now supports the new URL()
pattern as well. Can you check if this is still an issue?
Closing this. But please re-open if it’s still broken
If I modify the demo gist to serve the project root instead of the
dist
folder loading worker modules fails because it assumes all emitted files are directly under the document root.Here's a repo with reproduction.
Note the actual comlink file is under
http://127.0.0.1:8080/dist/
in the screenshot above.Edit: I've also tried to load the bundle with SystemJS, the bundle path resolves correctly but is missing the
js
file extension for some reason. Same repo, systemjs branch.