Skip to content

Fix #9769: 该 Issue 指出 JS Transformer 在处理较新的 core-js 特性(如 3.24 版本引入的 s...#10286

Open
Br1an67 wants to merge 1 commit intoparcel-bundler:v2from
Br1an67:fix/issue-9769-fix-9769
Open

Fix #9769: 该 Issue 指出 JS Transformer 在处理较新的 core-js 特性(如 3.24 版本引入的 s...#10286
Br1an67 wants to merge 1 commit intoparcel-bundler:v2from
Br1an67:fix/issue-9769-fix-9769

Conversation

@Br1an67
Copy link

@Br1an67 Br1an67 commented Mar 8, 2026

Fixes #9769

Fix for #9769: 该 Issue 指出 JS Transformer 在处理较新的 core-js 特性(如 3.24 版本引入的 structuredClone)时,未能正确注入所需的 Polyfill,导致旧版浏览器报错。问题根源在于 SWC 默认将 core-js 版本视为 3.0,导致其忽略 3.0 之后添加的特性支持。

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.
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.

JS Transformer does not correctly polyfill new core-js features

1 participant