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

Document webpack change: Add a new output option, workerPublicPath #6711

Closed
webpack-bot opened this issue Mar 23, 2023 · 0 comments · Fixed by #6712
Closed

Document webpack change: Add a new output option, workerPublicPath #6711

webpack-bot opened this issue Mar 23, 2023 · 0 comments · Fixed by #6712

Comments

@webpack-bot
Copy link

A pull request by @thomastay was merged and maintainers requested a documentation change.

See pull request: webpack/webpack#16671


Presently, Webpack assumes that the worker.js script is located in the same location as the publicPath. The application I work on does not work like that, the worker script and the rest of the script files are located at two separate domains in order to satisfy the Same Origin worker requirement.

Webpack has a feature for making the publicPath a function, unfortunately it is a fairly obscure feature and I can't track down where it applies in the codebase. AFAIK it only applies in AssetGenerator.js to generate the hashes.

There was some work in #14680 to support Cross origin worker loading, however this is unrelated to this change. This PR will not solve cross origin workers. In fact the worker public path option has to be located at the same origin. In our app, the publicPath is a CDN domain, and the worker public path is the same-origin domain.

What kind of change does this PR introduce?

Adds in a new output option for the Worker script that tells Webpack where to expect the worker script to be.

Did you add tests for your changes?
Done

Does this PR introduce a breaking change?
No

What needs to be documented once your changes are merged?
New option. Documentation is already in the comments.

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

Successfully merging a pull request may close this issue.

1 participant