Closed im7mortal closed 2 months ago
Have you tried the webpack5 example?
https://github.com/josdejong/workerpool/tree/master/examples/webpack5
@josdejong Thank you! It worked!
I am thinking if it would be possible to contribute to docs so it would be easier to find. I will close issue after
Good to hear.
A PR improving the docs would be welcome :)
I'll close this issue since the question is answered. A PR improving the docs is still welcome of course.
I couldn't find in the documentation if it can be used with Webpack 5 for Web Workers.
So in the official documentation it's told:
Webpack 5 will recognize that the TypeScript file inside the URL within the Worker must be compiled separately. It will then substitute the path string with a unique hash name of the separately generated file.
However, since workerpool doesn't use the new Worker(new URL("path")) pattern, Webpack 5 cannot compile it separately and perform the substitution.
Possible workaround for now
I use workerpool for my personal project, so I can experiment with unconventional solutions. I know that inside the worker we can actually get the path of the file with:
Therefore, I am considering initializing the worker with a function that will retrieve the href and then initialize workerpool with it.