Skip to content

Improve documentation for workers #6716

Open
@alexander-akait

Description

@alexander-akait
          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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions