-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
File polyfills-legacy should not be in strict mode (Plugin legacy) #6427
Comments
Have you solved it? Or another way? |
I solved it in some ugly way that I wrote my own Vite plugin.
|
I tried too, but because of using transform hook or other hooks, not renderChunk hook , it didn't succeed, so thank you very much for sharing |
sometimes you need to use generateBundle hook, such as dealing with polyfills-legacy.js |
I was not able to reproduce it with IE11. Also |
The latest plugin-legacy doesn't require adding regenerator-runtime anymore (#8007), so I think this is resolved. https://stackblitz.com/edit/vite-h5edus?file=vite.config.js There is a separate issue with setting |
Describe the bug
For older browsers with IE 11 support generated file polyfills-legacy.[hash].js should not contain
use strict
directive, but it does.It is required by polyfill regenerator-runtime/runtime which contains a comment:
This module should not be running in strict mode, ...
(https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736)Because the built-in file contains
use strict
, it will result in an error.Even if I have set
Reproduction
https://stackblitz.com/edit/vite-v5p4en
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: