next.js: Cannot debug Next15 using turbopack on windows
Link to the code that reproduces this issue
https://github.com/leandroluk/bug-next15-debug-with-turbopack
To Reproduce
- Install dependencies
- Select “turbo” in “Run and Debug” menu
- Select “Browser Debug” in running bar and this error message will appear:
- When select “webpack” in “Run and Debug” menu and look for “Browser Debug” the error doesnt appear and any breakpoint works.
Current vs. Expected behavior
Are expected to debug works like webpack.
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Home Single Language
Available memory (MB): 32453
Available CPU cores: 20
Binaries:
Node: 20.17.0
npm: 10.9.0
Yarn: 1.22.22
pnpm: 9.11.0
Relevant Packages:
next: 15.0.3 // Latest available version is detected (15.0.3).
eslint-config-next: 15.0.3
react: 19.0.0-rc-66855b96-20241106
react-dom: 19.0.0-rc-66855b96-20241106
typescript: 5.6.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
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 8
- Comments: 18 (7 by maintainers)
Commits related to this issue
- fix(turbopack): Fix sourcemap path on windows (#78453) ### What? Fix source map path on Windows by fixing the `url_to_file` function. Note: This PR is based on https://github.com/vercel/next.js/pul... — committed to d3x41/next.js by kdy1 2 years ago
- fix(turbopack): Fix sourcemap path on windows (#78453) ### What? Fix source map path on Windows by fixing the `url_to_file` function. Note: This PR is based on https://github.com/vercel/next.js/pul... — committed to vercel/next.js by kdy1 2 years ago
Hello! Just rebumping this issue. Found a couple of things regarding the launch.json and turbopack.
https://github.com/vercel/next.js/issues/74002 I closed this one as it was a duplicate of mine. apologies. But the issue still stands as you really cannot start a debug on vscode (have not tried other IDEs) if you have special characters in your folder structure. Turbopack seems to translate the special characters into url friendly encoded characters.
i.e () would equal to %28 and %29 respectively.
I am currently using this as my launch.json config
Add a breakpoint then hover over the breakpoint. It will now show you that the breakpoint you added is unbounded:
Go to the browser that just opened (this is assuming you have chrome running since it is under debugWithChrome AND using my launch.json setting). Go devtools and under Sources, make sure to group the files into Authored and Deployed
Find your folder structure that has your page.tsx (should be under Authored), and add a breakpoint in the chrome-debugger here:
Now refresh the page and you will find that the file that it opens in vscode is under the _next folder that is dynamically created when you run nextjs 15.
I expect that the breakpoint be hit using the local files given the sourcemap is correct.
Instead what i get is that the file being read/debugged/hit is under _next folder.
Only when adding a “sourceMapPathOverrides”: { “file://B%3A/_devlib/web/with-turbopack-app/": "${workspaceFolder}/” }
And overriding the url-encoded path will make the breakpoint succeed in getting hit.
As of right now. In order for my to bypass the issue of not being able to use turbopack. I remove the line
--turbopackin my launch.json config and continue to use webpack as a fallback.Thank you so much for all your help. It really helped 😄 👍
Thank!Thank !
Thank you also! Appreciate the big help here!
Ty so much for the patience and doing the heavy lifting (knowing where to start)
I had to make one more change but built locally / tested and its working so far!
Having issues using attach as well, not sure if it’s related to windows or not. A few things I noticed If I start my dev sever with:
I get:
None of those debugging ports show up in vscode. However, a port scan shows they are open and listening. I don’t know if this is an issue with next or vscode, but I don’t normally have issues attaching to debugging ports in other projects.
yields
Running dev server without turbopack is painfully slow for me.
Seeing essentially the same issue on Mac.
launch.json:Hi @leandroluk. I’m experiencing the same behavior on my machine with Windows 10, vscode 1.95.2 and npm. Could you consider adding the context that this issue occurs in VSCode and including the launch.json file in your example repo? I hope this helps to resolve the issue. Thanks! 👍