nextjs - 💡(How to fix) Fix Turbopack disables PropertyLiterals and MemberExpressionLiterals ES3 transforms, breaking Safari 15 strict mode [1 comments, 2 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#89808Fetched 2026-04-08 00:21:17
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×2commented ×1issue_type_added ×1

Root Cause

The root cause is in turbopack-ecmascript/src/transform/mod.rs where three ES3 transforms are excluded from preset_env:

Code Example

Operating System:                                                                                                                                                                                              
    Platform: linux                                                                                                                                                                                              
    Arch: arm64                                                                                                                                                                                                  
    Version: #1 SMP Thu Jan 15 14:58:53 UTC 2026                                                                                                                                                               
    Available memory (MB): 19972
    Available CPU cores: 16
  Binaries:
    Node: 20.20.0
    npm: 10.8.2
    Yarn: 1.22.22
    pnpm: 10.29.2
  Relevant Packages:
    next: 16.2.0-canary.35 // Latest available version is detected (16.2.0-canary.35).
    eslint-config-next: N/A
    react: 19.2.4
    react-dom: 19.2.4
    typescript: 5.9.3
  Next.js Config:
    output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/veniceai/turbopack-safari-reserved-words-repro

To Reproduce

  1. Clone the repo and install dependencies:
    git clone https://github.com/veniceai/turbopack-safari-reserved-words-repro cd turbopack-safari-reserved-words-repro
    npm install

  2. Build with Turbopack: npm run build

  3. Verify the output chunks contain unquoted reserved words: npm run verify (This finds 7 violations: {const:, let:, var:} as unquoted object keys in AJV chunks)

  4. Start the production server and open in Safari 15 / iOS 15 (e.g. via BrowserStack): npm start Open http://localhost:3000

  5. Safari 15 console shows: SyntaxError: Unexpected keyword 'var'. Expected '}' to end an object literal.

The bug is in turbopack-ecmascript/src/transform/mod.rs — PropertyLiterals and MemberExpressionLiterals are excluded from preset_env alongside ReservedWords. Only ReservedWords needs to be excluded (it breaks module resolution). The other two are safe and are needed to quote reserved-word property names for Safari 15.

Current vs. Expected behavior

● ## Current behavior

Turbopack production builds (next build --turbo) emit unquoted reserved words
as object property names in JS chunks. For example, AJV's codegen/scope.js:

exports.varKinds = {const: new Name("const"), let: new Name("let"), var: new Name("var")}

Safari 15 / iOS 15 parses ES modules in strict mode, and its parser incorrectly rejects unquoted reserved words as property names with:

SyntaxError: Unexpected keyword 'var'. Expected '}' to end an object literal.
SyntaxError: Unexpected keyword 'let'. Cannot use 'let' as an identifier name for a LexicalDeclaration.

This affects any dependency that uses reserved words as object keys. Common ones include ajv, @chakra-ui/styled-system, framer-motion, and mingo.

The root cause is in turbopack-ecmascript/src/transform/mod.rs where three ES3 transforms are excluded from preset_env:

exclude: vec![
    FeatureOrModule::Feature(Feature::ReservedWords),
    FeatureOrModule::Feature(Feature::MemberExpressionLiterals),
    FeatureOrModule::Feature(Feature::PropertyLiterals),
]

ReservedWords must be excluded (it breaks Turbopack's module resolution), but PropertyLiterals and MemberExpressionLiterals are safe — they only affect property name quoting, not identifier resolution.

Expected behavior

Turbopack should quote reserved-word property names in output chunks:

exports.varKinds = {"const": new Name("const"), "let": new Name("let"), "var": new Name("var")}

This is what webpack/Babel builds produce via @babel/plugin-transform-property-literals, and what SWC's swc_ecma_compat_es3::prop_lits transform does when enabled.

The fix is to only exclude ReservedWords from preset_env, leaving PropertyLiterals and MemberExpressionLiterals enabled:

exclude: vec![
    FeatureOrModule::Feature(Feature::ReservedWords),
]

iOS 15 / Safari 15 still has ~5-8% mobile market share. All Turbopack production builds are broken for these users if any dependency uses reserved words as property names.

Provide environment information

Operating System:                                                                                                                                                                                              
    Platform: linux                                                                                                                                                                                              
    Arch: arm64                                                                                                                                                                                                  
    Version: #1 SMP Thu Jan 15 14:58:53 UTC 2026                                                                                                                                                               
    Available memory (MB): 19972
    Available CPU cores: 16
  Binaries:
    Node: 20.20.0
    npm: 10.8.2
    Yarn: 1.22.22
    pnpm: 10.29.2
  Relevant Packages:
    next: 16.2.0-canary.35 // Latest available version is detected (16.2.0-canary.35).
    eslint-config-next: N/A
    react: 19.2.4
    react-dom: 19.2.4
    typescript: 5.9.3
  Next.js Config:
    output: N/A

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

Turbopack

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

Vercel (Deployed)

Additional context

No response

extent analysis

Fix Summary

Only exclude ReservedWords from the ES‑3 preset; keep PropertyLiterals and MemberExpressionLiterals enabled so Turbopack will automatically quote reserved‑word keys (e.g. "var").

1. Patch the Turbopack source

Edit turbopack-ecmascript/src/transform/mod.rs:

@@
-    exclude: vec![
-        FeatureOrModule::Feature(Feature::ReservedWords),
-        FeatureOrModule::Feature(Feature::MemberExpressionLiterals),
-        FeatureOrModule::Feature(Feature::PropertyLiterals),
-    ],
+    // Keep ReservedWords excluded (required for module resolution) but
+    // *enable* the ES3 transforms that quote property names.
+    exclude: vec![
+        FeatureOrModule::Feature(Feature::ReservedWords),
+    ],

2. Re‑compile Turbopack

If you’re using the bundled Turbopack from next, you need a custom build:

# From the repo root
cd packages/turbopack
cargo build --release          # or `cargo test` to ensure it compiles
# The built binary will be placed in `target/release/turbopack`

Replace the binary used by Next:

# Assuming a monorepo layout; adjust

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