nextjs - ✅(Solved) Fix Turbopack builds do not correctly process all files (ex: turbopack runtime) through the browserslist system [2 pull requests, 7 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#83799Fetched 2026-04-08 02:21:26
View on GitHub
Comments
7
Participants
3
Timeline
26
Reactions
2
Author
Timeline (top)
subscribed ×8commented ×7labeled ×4cross-referenced ×3

Fix Action

Fixed

PR fix notes

PR #84931: Turbopack: transpile runtime with swc

Description (problem / solution / changelog)

Transpile the Turbopack runtime according to browserslist We need to inline swc helpers, as the runtime is what provides the module system at runtime (so we cannot require anything here)

Part of #83799
Related to PACK-5450

Closes PACK-5697

Changed files

  • crates/next-core/src/segment_config.rs (modified, +1/-0)
  • turbopack/crates/turbopack-ecmascript-runtime/src/asset_context.rs (modified, +2/-4)
  • turbopack/crates/turbopack-ecmascript/Cargo.toml (modified, +1/-0)
  • turbopack/crates/turbopack-ecmascript/src/lib.rs (modified, +5/-1)
  • turbopack/crates/turbopack-ecmascript/src/parse.rs (modified, +39/-37)
  • turbopack/crates/turbopack-ecmascript/src/webpack/parse.rs (modified, +1/-0)
  • turbopack/crates/turbopack-ecmascript/src/webpack/references.rs (modified, +1/-0)
  • turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/options.json (modified, +2/-1)
  • turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/5c1d0_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_5aaf1327.js (modified, +1660/-1)
  • turbopack/crates/turbopack-tests/tests/snapshot/swc_transforms/preset_env/output/780ce_turbopack-tests_tests_snapshot_swc_transforms_preset_env_input_index_5aaf1327.js.map (modified, +5/-1)
  • turbopack/crates/turbopack/src/module_options/mod.rs (modified, +2/-0)
  • turbopack/crates/turbopack/src/module_options/module_options_context.rs (modified, +3/-0)

PR #2703: feat(pack): support browser list query for output assets

Description (problem / solution / changelog)

Summary

Support config:

{
  "config": {
    "entry": [
      {
        "import": "input/index.js",
        "name": "main"
      }
    ],
    "target": "Android 4, iOS 8",
}

Runtime code still have something not done: https://github.com/vercel/next.js/issues/83799#issuecomment-3664176756

Need to discuss with turbopack team and finish it.

Test Plan

Add test case.

Changed files

  • crates/pack-core/src/client/context.rs (modified, +1/-0)
  • crates/pack-core/src/library/runtime/asset_context.rs (modified, +1/-2)
  • crates/pack-core/src/server/contexts.rs (modified, +1/-0)
  • crates/pack-tests/tests/snapshot/node_modules/@swc/helpers/_/_async_to_generator.js (added, +5/-0)
  • crates/pack-tests/tests/snapshot/node_modules/@swc/helpers/_/_create_class.js (added, +10/-0)
  • crates/pack-tests/tests/snapshot/node_modules/@swc/helpers/_/_object_spread.js (added, +3/-0)
  • crates/pack-tests/tests/snapshot/node_modules/@swc/helpers/_/_object_spread_props.js (added, +3/-0)
  • crates/pack-tests/tests/snapshot/node_modules/@swc/helpers/_/_to_consumable_array.js (added, +6/-0)
  • crates/pack-tests/tests/snapshot/node_modules/@swc/helpers/_/_ts_generator.js (added, +10/-0)
  • crates/pack-tests/tests/snapshot/style/global_scoped/output/input_b49c0d7d.css (modified, +1/-1)
  • crates/pack-tests/tests/snapshot/target_web/legacy_mobile/config.json (added, +15/-0)
  • crates/pack-tests/tests/snapshot/target_web/legacy_mobile/input/index.js (added, +38/-0)
  • crates/pack-tests/tests/snapshot/target_web/legacy_mobile/input/lazy.js (added, +5/-0)
  • crates/pack-tests/tests/snapshot/target_web/legacy_mobile/output/_project___5c265bc3.js (added, +212/-0)
  • crates/pack-tests/tests/snapshot/target_web/legacy_mobile/output/_project___5c265bc3.js.map (added, +13/-0)
  • crates/pack-tests/tests/snapshot/target_web/legacy_mobile/output/input_lazy_456d4ef4.js (added, +22/-0)
  • crates/pack-tests/tests/snapshot/target_web/legacy_mobile/output/input_lazy_456d4ef4.js.map (added, +6/-0)
  • crates/pack-tests/tests/snapshot/target_web/legacy_mobile/output/main.js (added, +5/-0)
  • crates/pack-tests/tests/snapshot/target_web/legacy_mobile/output/main.js.map (added, +5/-0)

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:54 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T6041
  Available memory (MB): 65536
  Available CPU cores: 16
Binaries:
  Node: 22.12.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 8.15.9
Relevant Packages:
  next: 15.5.3 // Latest available version is detected (15.5.3).
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.2
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/krzkz94/turbopack-modern-syntax-browserslist

To Reproduce

Clone the repository https://github.com/krzkz94/turbopack-modern-syntax-browserslist

Install dependencies npm i

Run the build npm run build

Run the following command in the build folder which will grep all modern syntax chmod +x ./check-failures-only.sh && ./check-failures-only.sh

The above is a simple helper tool to identify transpilation issues, only runs 'grep' against the most common modern syntax I could think of.

According to the default browserslist defined here https://nextjs.org/docs/architecture/supported-browsers

The syntax below is not being transformed Optional Chaining (?.) Introduced in: Chrome 80, Edge 80, Firefox 72, Opera 67, Safari 13.1 Nullish Coalescing (??) Introduced in: Chrome 80, Edge 80, Firefox 72, Opera 67, Safari 13.1 Nullish Assignment (??=) Introduced in: Chrome 85, Edge 85, Firefox 79, Opera 71, Safari 14 Private Class Fields (#field) Introduced in: Chrome 74, Edge 79, Firefox 90, Opera 62, Safari 14.1 globalThis Introduced in: Chrome 71, Edge 79, Firefox 65, Opera 58, Safari 12.1

One thing to note, the turbopack runtime is not transformed either (when it should)

Can a member of the Next/Turbopack team confirm or deny that every dependency (also transient dependencies) should be ran through the browserslist, even if it's not part of transpilePackages? The majority of nextjs compatibility issues comes from sub-dependencies (even 4 levels deep), so if you want to make your site compatible with for example smart tv's from 2022 (which run chrome 68), it's basically impossible as your transpilePackages would have to be thousands of lines long. I know for webpack at least, transpilePackages ignores sub-dependencies.

Current vs. Expected behavior

Currently, a lot of modern syntax is not ran through the browserslist compatibility / polyfill / transpilation logic

Expected: All modern syntax that doesn't match the browserslist should be transformed.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:54 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T6041
  Available memory (MB): 65536
  Available CPU cores: 16
Binaries:
  Node: 22.12.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 8.15.9
Relevant Packages:
  next: 15.5.3 // Latest available version is detected (15.5.3).
  eslint-config-next: N/A
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack, Runtime, Webpack

Which stage(s) are affected? (Select all that apply)

next build (local), next dev (local)

Additional context

No response

<sub>PACK-5450</sub>

extent analysis

TL;DR

The issue can be addressed by confirming whether all dependencies, including transient ones, should be processed through the browserslist configuration in Turbopack.

Guidance

  • Review the Turbopack documentation to understand how it handles browserslist configuration for dependencies, especially those not listed in transpilePackages.
  • Investigate how Webpack's transpilePackages option treats sub-dependencies to compare behaviors between Turbopack and Webpack.
  • Consider testing the build process with explicitly listed dependencies in transpilePackages to see if it affects the transformation of modern syntax.
  • Verify if the version of Next.js (

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING