Closed fuma-nama closed 1 month ago
Same cryptic error is happening when using Next Auth with turbo enabled.
https://github.com/nextauthjs/next-auth/issues/11674
Not even sure where this is referenced, but that path/file does not even exist:
node_modules/next/dist/server/future/route-modules/app-route/vendored/contexts/router-context.js
Just verified this is already fixed on next@canary, please make sure to check next@canary as there's hundreds of changes to Turbopack on canary currently 👍
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/7ystyy
To Reproduce
http://localhost:3000/api
Current vs. Expected behavior
It throws an error:
(see the rest of the error in CodeSandbox)
Ideally, it should ignore Next.js itself, or be able to parse/bundle it correctly.
Provide environment information
Which area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I agree that it's probably weird to import Next.js components (Image/Link) from route handlers. For my case, it's because I use a MDX loader, and the transformed MDX file exports necessary frontmatter information, which is needed to construct the response.
I have to import the MDX file from a route handler:
Because the
file.mdx
file has imports to Next.js Link component, this causes the problem above.