vercel / vercel/next.js

Turbopack builds do not correctly process all files (ex: turbopack runtime) through the browserslist system

Open
#83,799 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

linear: turbopack Runtime Turbopack Webpack
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

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

PACK-5450

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone the linked reproduction repository, install dependencies with npm i, and run npm run build. Use check-failures-only.sh to inspect untransformed syntax and compare the generated output with the stated browserslist; done means the affected build and runtime files are transformed consistently for the target browsers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system, frontend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.