-
-
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
plugin-legacy:Unexpected token import #2786
Comments
Having the same issue in a large react project with code splitting targeting IE 11. |
Ran into this as well. It only occured after the project got bigger in size. Fiddled around and it seems even if |
I'm having es imports in the legacy chunk as well. For me, entry legacy chunk starts with Update. I did some further debugging and the imports are cleared if |
Ok, so i found a way to fix it in our project. Moving the recording and removing of polyfills from Since this is hard to reproduce it would be great with proof this actually fixes the issue before PR. @fnlctrl, @vibo and/or @rashagu: Could you try adding https://github.com/TobiasMelen/vite/blob/record-remove-polyfills-post/packages/plugin-legacy/index.js to a seperate js file and importing the plugin from that local file instead and then test if builds strip all |
@TobiasMelen just tested and it works👍 |
@TobiasMelen I have tried to build with the new code https://github.com/TobiasMelen/vite/blob/record-remove-polyfills-post/packages/plugin-legacy/index.js with my project, it works perfect! the version of plugins is as below: |
Can this issue be closes? (And the other #2781 too)? Or do we need something in a PR? |
Needs PR. Since it seems to solve the issue i will add a one when i can, probably later today. |
Describe the bug
I used the plugin @vitejs/plugin-legacy
But the packaged code still contains
import"core-js/modules/es.promise.js";
Reproduction
When some components are split into a single file
In fact, I can’t reproduce this bug with the least amount of code
System Info
The text was updated successfully, but these errors were encountered: