Fix #9769: 该 Issue 指出 JS Transformer 在处理较新的 core-js 特性(如 3.24 版本引入的 s...#10286
Open
Br1an67 wants to merge 1 commit intoparcel-bundler:v2from
Open
Fix #9769: 该 Issue 指出 JS Transformer 在处理较新的 core-js 特性(如 3.24 版本引入的 s...#10286Br1an67 wants to merge 1 commit intoparcel-bundler:v2from
Br1an67 wants to merge 1 commit intoparcel-bundler:v2from
Conversation
The swc preset_env requires the core_js option to be set with the minor version (e.g., '3.37') to correctly include polyfills for newer features. Without this, swc defaults to '3.0' which lacks polyfills for features added in later core-js versions like structuredClone (core-js 3.24+). This fix detects the installed core-js version from package.json and passes it to swc's preset_env configuration.
32e7494 to
965ff6d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #9769
Fix for #9769: 该 Issue 指出 JS Transformer 在处理较新的 core-js 特性(如 3.24 版本引入的 structuredClone)时,未能正确注入所需的 Polyfill,导致旧版浏览器报错。问题根源在于 SWC 默认将 core-js 版本视为 3.0,导致其忽略 3.0 之后添加的特性支持。