Skip to content
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

[@vitejs/plugin-legacy] Why need regenerator-runtime when targeting IE11? #7987

Closed
7 tasks done
l1shu opened this issue May 2, 2022 · 0 comments · Fixed by #8007
Closed
7 tasks done

[@vitejs/plugin-legacy] Why need regenerator-runtime when targeting IE11? #7987

l1shu opened this issue May 2, 2022 · 0 comments · Fixed by #8007
Labels
documentation Improvements or additions to documentation plugin: legacy

Comments

@l1shu
Copy link

l1shu commented May 2, 2022

Describe the bug

I found the docs says:

image

The associated issue is:#3362

But I don't understand why this is needed, because I found that regenerator-runtime will still be included in polyfills-legacy.xxx.js even if I don't add it with additionalLegacyPolyfills , I tried a minimal reproduction:

here is the main.js:
image
I use async in code, let babel useBuiltIns usage to import renerator-runtime/runtime.js

here is the vite.config.js:
image
Notice I do not manualy add regenerator-runtime by additionalLegacyPolyfills

and try debug in @vitejs/plugin-legacy source code:
image

Now run yarn build:
image
here the regenerator-runtime was auto-detection added by babel

and see the output polyfills-legacy.xxx.js:
image
I think the regenerator-runtime has been successfully added.

So I'm comfused about why the docs says should need regenerator-runtime when targeting IE11, is this a description error?

Thanks all

Reproduction

https://stackblitz.com/edit/vitejs-vite-zreonp?file=vite.config.js&terminal=dev

System Info

System:
    OS: macOS 12.3.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 64.06 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 1.22.18 - ~/.nvm/versions/node/v16.14.2/bin/yarn
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
  Browsers:
    Chrome: 100.0.4896.127
    Safari: 15.4
  npmPackages:
    @vitejs/plugin-legacy: ^1.8.1 => 1.8.1 
    @vitejs/plugin-vue: ^2.3.1 => 2.3.1 
    vite: ^2.9.5 => 2.9.6

Used Package Manager

yarn

Logs

No response

Validations

@sapphi-red sapphi-red added plugin: legacy documentation Improvements or additions to documentation and removed pending triage labels May 2, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation plugin: legacy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants