Skip to content
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

Improve documentation for workers #6716

Open
alexander-akait opened this issue Mar 27, 2023 · 1 comment
Open

Improve documentation for workers #6716

alexander-akait opened this issue Mar 27, 2023 · 1 comment

Comments

@alexander-akait
Copy link
Member

          Looks like I've solved most of the issues, the trick was to explicitly supply a true worker path as `__webpack_public_path__` and `__webpack_require__.p` inside the worker. Still needs a small blob helper to overcome the same-origin policy.

What's supported:

  • cross-domain worker
  • no worker loader
  • sourcemaps
  • dynamic import() of images and anything else

https://github.com/kirill-konshin/cross-domain-worker/blob/main/packages/cross-domain-worker/src/index.js I have published the NPM package cross-domain-worker since the solution is quite reusable.

https://github.com/kirill-konshin/cross-domain-worker/blob/main/packages/host/src/index.js usage in main thread.

https://github.com/kirill-konshin/cross-domain-worker/blob/main/packages/worker/src/worker.js usage in worker.

Originally posted by @kirill-konshin in webpack/webpack#16696 (comment)

@alexander-akait
Copy link
Member Author

I think the best place here - https://webpack.js.org/guides/web-workers/

@kirill-konshin Maybe you want to help other developers and send a PR

So we will show how to build web worker in multi compiler mode + handle cross-domain + dynamic public path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant