Closed segevfiner closed 1 year ago
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.
BTW, Firefox might be going to add ESM workers in v110
Supported with vite-plugin-top-level-await v1.3.0
.
AFAIK Firefox doesn't support ESM in workers ATM so setting
workers.format
toes
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?