-
Notifications
You must be signed in to change notification settings - Fork 30k
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.Confirmed issue that is tracked by the Turbopack team.locked
Description
Link to the code that reproduces this issue
https://github.com/tnunamak/turbopack-openpgp-repro
To Reproduce
- Clone https://github.com/tnunamak/turbopack-openpgp-repro
npm installnpm run dev- Visit http://localhost:3000/api/test - Works
npm run dev:turbo- Visit http://localhost:3000/api/test - Fails
Current vs. Expected behavior
Current Behavior
Static imports of OpenPGP.js fail with Turbopack but work with webpack.
ReferenceError: Cannot access 'globalThis' before initialization
at [project]/app/api/test/route.ts [app-route] (ecmascript) (app/api/test/route.ts:2:0)
Expected Behavior
Static imports should work with Turbopack as they do with webpack, since:
- OpenPGP.js docs show static imports as the standard usage
globalThisis a standard ES2020 feature- Works in Node.js, webpack, and other bundlers
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #27-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 17:01:58 UTC 2025
Available memory (MB): 127934
Available CPU cores: 24
Binaries:
Node: 24.3.0
npm: 11.4.2
Yarn: N/A
pnpm: 10.13.1
Relevant Packages:
next: 15.4.6 // Latest available version is detected (15.4.6).
eslint-config-next: N/A
react: 19.1.1
react-dom: 19.1.1
typescript: 5.9.2
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
Metadata
Metadata
Assignees
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.Confirmed issue that is tracked by the Turbopack team.locked