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

feat: align with @vitejs/plugin-legacy 5.3.2 #8

Merged
merged 3 commits into from
Mar 18, 2024
Merged

feat: align with @vitejs/plugin-legacy 5.3.2 #8

merged 3 commits into from
Mar 18, 2024

Conversation

ModyQyW
Copy link
Contributor

@ModyQyW ModyQyW commented Mar 13, 2024

closes #7

  • chore(deps): update all non-major dependencies
  • fix(plugin-legacy): dynamic import browserslist-to-esbuild
  • fix(plugin-legacy): replace esbuild-plugin-browserslist with browserslist-to-esbuild
  • fix(plugin-legacy): respect modernTargets option if renderLegacyChunks disabled
  • feat(plugin-legacy): add modernTargets option

@ModyQyW
Copy link
Contributor Author

ModyQyW commented Mar 18, 2024

modernTargets defaults to edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12, which is different with @vitejs/plugin-legacy (edge>=80, firefox>=72, chrome>=80, safari>=13.1, chromeAndroid>=80, iOS>=13.1).

The reason is listed in the code before: However, since esbuild only transform syntax rather than polyfill, the output is not guaranteed to support es2020. So this feature cannot be used as a basis for compatibility.. Should I sync this?

@CyanSalt
Copy link
Owner

Thx for your contribution! I noticed that vitejs/vite#15789 has been merged. Can you synchronize the changes to this PR? I think it might be important.

@CyanSalt
Copy link
Owner

Sorry I just noticed it's actually included. LGTM!

@CyanSalt CyanSalt merged commit a8a9cfc into CyanSalt:main Mar 18, 2024
@CyanSalt
Copy link
Owner

CyanSalt commented Mar 18, 2024

modernTargets defaults to edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12, which is different with @vitejs/plugin-legacy (edge>=80, firefox>=72, chrome>=80, safari>=13.1, chromeAndroid>=80, iOS>=13.1).

The reason is listed in the code before: However, since esbuild only transform syntax rather than polyfill, the output is not guaranteed to support es2020. So this feature cannot be used as a basis for compatibility.. Should I sync this?

I think there should be some inconsistency here. This behavior can ensure that the generated code is always correctly polyfilled, otherwise there may be some methods that are incompatible with browsers in the gap, which had occurred in my project with millions of users. Although I'm not sure if there is any difference in syntax conversion between babel and swc.

@ModyQyW
Copy link
Contributor Author

ModyQyW commented Mar 18, 2024

modernTargets defaults to edge>=79, firefox>=67, chrome>=64, safari>=12, chromeAndroid>=64, iOS>=12, which is different with @vitejs/plugin-legacy (edge>=80, firefox>=72, chrome>=80, safari>=13.1, chromeAndroid>=80, iOS>=13.1).
The reason is listed in the code before: However, since esbuild only transform syntax rather than polyfill, the output is not guaranteed to support es2020. So this feature cannot be used as a basis for compatibility.. Should I sync this?

I think there should be some inconsistency here. This behavior can ensure that the generated code is always correctly polyfilled, otherwise there may be some methods that are incompatible with browsers in the gap, which had occurred in my project with millions of users. Although I'm not sure if there is any difference in syntax conversion between babel and swc.

I think we can just keep it.

@ModyQyW
Copy link
Contributor Author

ModyQyW commented Apr 9, 2024

vitejs/vite@4af9f97

For new comers, now the modernTargets default value is the same as @vitejs/plugin-legacy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Align @vitejs/plugin-legacy@v5.3
2 participants