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
Allow Web Workers on legacy #10383
Comments
5 tasks
Alternatively, and maybe it will be simpler, we can just check if the current format is Any thoughts? |
4 tasks
11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Web workers are broken on legacy mode, althought caiuseit shows it can be used on legacy browsers(IE10+ supports for example non-shared web workers). Not even a warning is displayed to the user.
This could have been filed as a bug request, but I think it's better as a feature.
Suggested solution
I saw the code of the Vite
worker
plugin, and the initial impression is that plugin-legacy can use a regular expressions onrenderChunk
to find the locations the expression "new Worker" is defined, find the right worker file it reference, and transform it to legacy using Babel. But:inline
as a query param in import).Can we somehow overcome this, maybe by replace the worker constructions with some tokens on
transform()
, and resolves them later in therenderChunk
phase?This way:
worker
plugin will check if the current format isn'tsystem
, and only then will emit the workers assets and replace the URL/inlined-code there.system
format, and will transform the worker code via Babel to support legacy.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: