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

Support code splitting in web workers #1654

Closed
devongovett opened this issue Jul 3, 2018 · 2 comments
Closed

Support code splitting in web workers #1654

devongovett opened this issue Jul 3, 2018 · 2 comments

Comments

@devongovett
Copy link
Member

We currently don't support code splitting in web workers via import(), because the bundle loader for JS relies on the DOM. We should extend this to also support web workers.

This will allow moving common dependencies between workers, or even between workers and the main process to a separate bundle so it only gets loaded once. See https://twitter.com/DasSurma/status/1013489346090012672. cc. @surma.

In order to be consistent about how require() works, we won't make it automatically create a split point when called in a worker, as that would cause the code to potentially be removed from another bundle. But if you use import() to load the shared module in both the main bundle and a worker, the module would be placed into its own bundle and loaded in both places.

Related: #758

@abaybektursun
Copy link

What's the workaround?

@devongovett
Copy link
Member Author

I believe this is fully supported as of #4309!

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

No branches or pull requests

2 participants