Error during dev and warning at build in middleware.ts with --turbo flag #75280
Labels
linear: turbopack
Confirmed issue that is tracked by the Turbopack team.
Middleware
Related to Next.js Middleware.
Runtime
Related to Node.js or Edge Runtime with Next.js.
Turbopack
Related to Turbopack with Next.js.
Link to the code that reproduces this issue
https://github.com/sommeeeer/next-middleware-edge-turbo-node
To Reproduce
pnpm dev
hello-from-function
.--turbo
flag:pnpm devturbo
Current vs. Expected behavior
So the
src/lib/node-native.ts
exports two functions. One is for themiddleware.ts
and the other one is a random asynchi()
function that dynamically imports a native Node.js API fromfs/promises
.Since we are not using this function in the middleware it should not be flagged. I think it should work the same way as normal
next dev
without the--turbo
flag.Can note that
next build
works but with warnings.Provide environment information
Operating System: Platform: linux Arch: x64 Version: #47~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Oct 2 16:16:55 UTC 2 Available memory (MB): 14800 Available CPU cores: 16 Binaries: Node: 20.18.0 npm: 10.9.1 Yarn: 1.22.19 pnpm: 9.15.4 Relevant Packages: next: 15.1.6 // Latest available version is detected (15.1.6). eslint-config-next: 15.1.6 react: 19.0.0 react-dom: 19.0.0 typescript: 5.7.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Turbopack, Middleware
Which stage(s) are affected? (Select all that apply)
next dev (local), next build (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: