bug: imported function becomes not defined with --turbopack
#79594
Labels
linear: turbopack
Confirmed issue that is tracked by the Turbopack team.
Turbopack
Related to Turbopack with Next.js.
Uh oh!
There was an error while loading. Please reload this page.
Description
This route handler successfully prints
err
in the firstconsole.log()
, but then something happens and it fails witherr is not defined
when trying to print it a second time.This only happens with
--turbopack
.Link to the code that reproduces this issue
https://github.com/vanaigr/next-not-defined-bug
Edited by @timneutkens: Simplified reproduction: https://codesandbox.io/p/github/vanaigr/next-not-defined-bug/csb-5qq4l8/draft/keen-field?file=%2Fapp%2Froute.ts%3A1%2C1-7%2C1. Just run
npm run dev
and open/
.To Reproduce
pnpm dev
in a terminalhttp://localhost:3000/Dashboard
pnpm dev-without-turbopack
http://localhost:3000/Dashboard
first
andsecond
print statements are successful:Current vs. Expected behavior
The route handler shouldn't crash with
err is not defined
.Provide environment information
/bin/sh: 1: yarn: not found Operating System: Platform: linux Arch: x64 Version: #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 Available memory (MB): 5865 Available CPU cores: 2 Binaries: Node: 23.11.0 npm: 10.9.2 Yarn: N/A pnpm: 9.7.1 Relevant Packages: next: 15.1.8 // Latest available version is detected (15.1.8). eslint-config-next: N/A react: 19.1.0 react-dom: 19.1.0 typescript: 5.8.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)
next dev (local)
Additional context
No response
PACK-4738
The text was updated successfully, but these errors were encountered: