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

fix(plugin-legacy): polyfill latest features #7514

merged 1 commit into from Mar 29, 2022


Copy link


plugin-legacy was not polyfilling features which are supported by core-js 3<.
For example, structuredClone is supported by core-js@v3.20.0 but the polyfill was not included currently.

Additional context

While looking at #7449, I found babel/babel#13701 (comment) and found this bug.
But for #7449 I think it is working correctly and this PR is not related.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@@ -83,4 +83,8 @@ if (isBuild) {
test('should emit css file', async () => {
expect(listAssets().some((filename) => filename.endsWith('.css')))

test('includes structuredClone polyfill which is supported after core-js v3', () => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's hacky...
Please tell me if there is a better way.

Copy link

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix! Quite a strange API, I would think that it is better to always use the latest installed version.
We are going to do a new minor for plugin-legacy soon, lets include this PR to get it there.

@patak-dev patak-dev merged commit cb388e2 into vitejs:main Mar 29, 2022
@sapphi-red sapphi-red deleted the fix/legacy-new-features branch March 30, 2022 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants