Skip to content

perf(legacy): skip lowering when detecting polyfills #20387

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

Conversation

sapphi-red
Copy link
Member

Description

When detecting polyfills for modern build, plugin-legacy was lowering the code as @babel/preset-env does.
This PR changes that part to use babel-plugin-polyfill-corejs3 and babel-plugin-polyfill-regenerator, which is used internally by @babel/preset-env, so that the lowering is not done.

I tested this PR with https://github.com/mastodon/mastodon and it reduced the build time from 27.25s to 24.17s.

@sapphi-red sapphi-red added plugin: legacy p2-nice-to-have Not breaking anything but nice to have (priority) labels Jul 10, 2025
@sapphi-red sapphi-red modified the milestone: 7.1 Jul 16, 2025
@sapphi-red sapphi-red merged commit 7cc0338 into vitejs:main Jul 17, 2025
18 checks passed
@sapphi-red sapphi-red deleted the perf/legacy-skip-lowering-when-detecting-polyfills branch July 17, 2025 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have Not breaking anything but nice to have (priority) plugin: legacy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants