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

Firefox web workers #18

Closed
segevfiner opened this issue Nov 19, 2022 · 3 comments
Closed

Firefox web workers #18

segevfiner opened this issue Nov 19, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@segevfiner
Copy link
Contributor

AFAIK Firefox doesn't support ESM in workers ATM so setting workers.format to es will break the resulting sure in Firefox. I think Vite explicitly has code to transform workers in dev mode rather than rely on ESM so they will work in Firefox. Any way to get this plugin to work with classic workers?

@Menci
Copy link
Owner

Menci commented Feb 6, 2023

Rollup only accepts code with TLA in ES mode, not in IIFE mode. So I'm going to add some magic hack in my plugin (vite-plugin-top-level-await) to make the worker code build as ES first and then transform the built code to IIFE to make it work in Firefox.

@segevfiner
Copy link
Contributor Author

segevfiner commented Feb 6, 2023

BTW, Firefox might be going to add ESM workers in v110

@segevfiner segevfiner reopened this Feb 6, 2023
@Menci
Copy link
Owner

Menci commented Feb 25, 2023

Supported with vite-plugin-top-level-await v1.3.0.

@Menci Menci closed this as completed Feb 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants