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 -sWASM_WORKERS=2 build mode better. #21614

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

juj
Copy link
Collaborator

@juj juj commented Mar 26, 2024

Document -sWASM_WORKERS=2 build mode better. It was previously documented directly in code in

// In WASM_WORKERS == 2 build mode, we create the Wasm Worker global scope
// script from a string bundled in the main application JS file. This
// simplifies the number of deployed JS files with the app, but has a downside
// that the generated build output will no longer be csp-eval compliant.
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src#unsafe_eval_expressions
, but was not that discoverable. Closes #21609.

@juj juj enabled auto-merge (squash) March 26, 2024 11:10
// file a.ww.js will be generated to bootstrap the Wasm Worker JS contexts.
// If 2, enables support for Wasm Workers, but without using a separate a.ww.js
// file on the side. This can simplify deployment of builds, but will have a
// downside that the generated build will no longer be csp-eval compliant.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds like just embedding the worker JS boostrap file inside the main JS file. However, in the other issue regarding this it sounded like i also related the generated html file. Am I misunderstanding something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, -sWASM_WORKERS=2 mode embeds the .ww.js file into the main .js file.

Commented in #17547 (comment) for more overview, maybe that helps.

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 this pull request may close these issues.

WASM_WORKERS=2 documentation
2 participants