File polyfills-legacy should not be in strict mode (Plugin legacy)
See original GitHub issueDescribe 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
rollupOptions: {
output: {
strict: false // no strict mode, ... but maybe Rollup is wrong, I am not sure
}
},
Reproduction
https://stackblitz.com/edit/vite-v5p4en
System Info
System:
OS: Linux undefined
CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: Unknown - /bin/jsh
Binaries:
Node: 14.16.0 - /usr/local/bin/node
Yarn: 1.22.10 - /bin/yarn
npm: 7.17.0 - /bin/npm
npmPackages:
@vitejs/plugin-legacy: ^1.6.4 => 1.6.4
vite: ^2.6.0 => 2.7.10
Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
@vitejs/plugin-legacy - npm
This plugin provides support for legacy browsers that do not support those features when building for production. By default, this plugin ...
Read more >Vite.js Next Generation Frontend Tooling + Craft CMS
Vite.js is next generation frontend tooling that can replace webpack, Mix, Gulp, etc. for building frontend assets like JavaScript and CSS.
Read more >hc-plugin-legacy - npm Package Health Analysis - Snyk
This plugin provides support for legacy browsers that do not support native ESM when building for production. By default, this plugin will:.
Read more >What is TypeScript Strict Mode? - YouTube
Let's talk about TypeScript Strict Mode ! Should you use it? (Yes!)When should you use it? (As soon as you can !)
Read more >Vitejs/plugin Legacy: Legacy Browser Support For Vite - Morioh
This plugin provides support for legacy browsers that do not support ... this option will exclude systemjs/dist/s.min.js inside polyfills-legacy chunk.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
sometimes you need to use generateBundle hook, such as dealing with polyfills-legacy.js
I was not able to reproduce it with IE11.
Also
regenerator-runtime/runtime
states it works if CSP is not enabled. So if CSP is not set, I think it would work. https://github.com/facebook/regenerator/blob/055b4030219f7cc0af5999ef4431c991697d7ee5/packages/runtime/runtime.js#L739-L748