plugin-legacy for IE11 dosen't work
See original GitHub issueDescribe the bug
Hello, I need some help, please. Just read the steps, ↓
you can glone this repository for more detail vite-for-ie11
- create a project with vanilla
yarn create vite vite-for-ie11 --template vanilla
- install plugin
@vitejs/plugin-legacy
yarn add @vitejs/plugin-legacy -D
- create config file and set configs
I just follow the tutorial
touch vite.config.js
// vite.config.js
import legacy from "@vitejs/plugin-legacy";
export default {
plugins: [
legacy({
// for ie11
targets: ["ie >= 11"],
additionalLegacyPolyfills: ["regenerator-runtime/runtime"],
}),
],
};
- add the test code
const apis = ["Proxy", "Reflect", "Promise", "Set", "Map"];
document.querySelector("#app").innerHTML = `
<h1>Hello Vite!</h1>
<a href="https://vitejs.dev/guide/features.html" target="_blank">Documentation</a>
<ol>${apis
.map((v) => `<li>${v}: ${Boolean(window[v]) ? "yes" : "no"}</li>`)
.join("")}</ol>
`;
Then I run yarn serve
, I got a error msg:
Unhandled promise rejection TypeError: Target is not iterable
Reproduction
https://github.com/Darcrandex/vite-for-ie11.git
System Info
System:
OS: Windows 10 10.0.18362
CPU: (4) x64 Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
Memory: 7.27 GB / 15.46 GB
Binaries:
Node: 14.16.1 - D:\nodejs\node.EXE
Yarn: 1.22.10 - D:\nodejs\yarn.CMD
npm: 6.14.12 - D:\nodejs\npm.CMD
Browsers:
Chrome: 90.0.4430.212
Edge: Spartan (44.18362.449.0)
Internet Explorer: 11.0.18362.1
npmPackages:
vite: ^2.4.4 => 2.4.4
Used Package Manager
yarn
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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
@vitejs/plugin-legacy doesn't work on ie11, the script ... - GitHub
I am trying to run my application on IE 11, it's using react and typescript, but the transpiled scripts do not work at...
Read more >React app created with VITE does not work in IE 11
I have tried the @vitejs/plugin-react and added it in the vite.config.ejs file. It looks like this: import { defineConfig } from 'vite'; import ......
Read more >Internet Explorer (IE) mode troubleshooting and FAQ
How to troubleshoot and fix · Open a new tab in Microsoft Edge and go to edge://net-export. · Select Start Logging to Disk,...
Read more >Internet Explorer retires on June 15 - what can developers do?
There is an IE11 compatibility mode to support legacy apps, but it may not work exactly the same. This legacy mode is supported...
Read more >Set up Legacy Browser Support for Microsoft Edge in IE mode
Enable IE integration: Turn on Configure Internet Explorer integration. Under Options, select Internet Explorer mode if you want sites to open in Microsoft...
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 Free
Top 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
PR here: https://github.com/vitejs/vite/pull/4440
@patak-js well actually this is not really an upstream bug because:
SystemJS relies on
Promise.all
which requires not only aes.promise
polyfill but also thees.array.iterator
polyfill see https://github.com/systemjs/systemjs/blob/75853dddde25b13244059babc2657a60196c1b13/src/system-core.js#L143babel-preset-env has no way to know what SystemJS requires in terms of polyfill. This documentation https://babeljs.io/docs/en/babel-plugin-syntax-dynamic-import#working-with-webpack-and-babelpreset-env (this is about webpack internal but this fundamentally the same issue)
So I think we should add
es.promise
+es6.array.iterator
at all time in the legacy plugin because systemJS needs it to operate correctly. It is cleary stated here: https://github.com/systemjs/systemjs#ie11-support