Skip to content
Discussion options

You must be logged in to vote

@ogonkov Sorry for delay, I see your problem, there are some limitation:

  • worker code is another chunk with own runtime code and in own DedicatedWorkerGlobalScope, so you should write __webpack_public_path__ = __PUBLIC_PATH__; line in src/worker/worker.js file
  • but there is no window in DedicatedWorkerGlobalScope

So solution - after creating worker you need to call worker.postMessage({ publicPath: __PUBLIC_PATH__ });, inside worker you need to handle it self.onmessage = async ({ data: { publicPath } }) => { if (publicPath) __webpack_public_path__ = publicPath /* other code of worker */ }), it will allow to override public path from window scope inside worker

Note - above is pseudo code, y…

Replies: 1 comment 20 replies

Comment options

You must be logged in to vote
20 replies
@ogonkov
Comment options

@alexander-akait
Comment options

@ogonkov
Comment options

@alexander-akait
Comment options

Answer selected by ogonkov
@ogonkov
Comment options

@ogonkov
Comment options

@alexander-akait
Comment options

@ogonkov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants