Turbopack "unreachable code" string causing warnings in Firefox
OleSkaar opened this issue · 0 comments
Link to the code that reproduces this issue
https://github.com/OleSkaar/with-turbopack-app
I've used the with-turbopack example here, with two dependencies that were giving the same error in my project:
"@tanstack/react-query": "5.62.2", "@tanstack/react-query-devtools": "5.62.2",
To Reproduce
- Start the application with
pnpm run dev
- Open the app at
localhost:3000
- Check the browser console in Firefox. You should see several warnings about unreachable code:
This is happening because of the "TURBOPACK unreachable";
statement that's inserted after the return statement in the code from react query dev tools:
Current vs. Expected behavior
I expect being able to load up this project without warnings in the console.
I believe Firefox is detecting the "TURBOPACK unreachable";
string as unreachable code and therefore reporting a warning (see this page).
The string appears before a function declaration, and this seemed to be the case for the other warnings reported here as well. This function is declared below the return the statement, but because of hoisting it is reachable (and used) higher up in the code. Could the "TURBOPACK unreachable";
string be inserted after the function declaration instead?
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6030
Available memory (MB): 36864
Available CPU cores: 12
Binaries:
Node: 20.13.1
npm: 10.5.2
Yarn: 1.22.22
pnpm: 9.14.4
Relevant Packages:
next: 15.1.2 // Latest available version is detected (15.1.2).
eslint-config-next: N/A
react: 18.3.1
react-dom: 18.3.1
typescript: 5.7.2
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Developer Experience, Module Resolution, Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response