question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

plugin-legacy for IE11 dosen't work

See original GitHub issue

Describe the bug

Hello, I need some help, please. Just read the steps, ↓

you can glone this repository for more detail vite-for-ie11

  1. create a project with vanilla
yarn create vite vite-for-ie11 --template vanilla
  1. install plugin @vitejs/plugin-legacy
yarn add @vitejs/plugin-legacy -D
  1. 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"],
    }),
  ],
};
  1. 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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AlexandreBonaventurecommented, Jul 29, 2021
1reaction
AlexandreBonaventurecommented, Jul 29, 2021

@patak-js well actually this is not really an upstream bug because:

  1. SystemJS relies on Promise.all which requires not only a es.promise polyfill but also the es.array.iterator polyfill see https://github.com/systemjs/systemjs/blob/75853dddde25b13244059babc2657a60196c1b13/src/system-core.js#L143

  2. babel-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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found