nextjs - 💡(How to fix) Fix Turbopack sourcemap url encoded prevent vscode debugger to work correctly through docker [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86464Fetched 2026-04-08 02:10:50
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
3
Participants
Timeline (top)
cross-referenced ×1issue_type_added ×1labeled ×1subscribed ×1

Root Cause

however now that next uses turbopack, I cannot find a suitable sourcemapoverrides, because turbopack url encodes the file path, which vscode & cursor does not seem to be able to treat.

Code Example

./up.sh

---

"sourceMapPathOverrides": {
        // Base path mappings
        "/usr/app/frontend/*": "${workspaceFolder}/frontend/*",
        "file:///usr/app/frontend/*": "${workspaceFolder}/frontend/*",

        // Turbopack protocol mappings
        "turbopack:///_N_E/*": "${workspaceFolder}/frontend/*",
        "turbopack:///./*": "${workspaceFolder}/frontend/*",
        "turbopack:///*": "${workspaceFolder}/frontend/*",

        // URL-encoded route segments (Turbopack encodes [segment] as %5Bsegment%5D)
        "file:///usr/app/frontend/app/%5Blocale%5D/*": "${workspaceFolder}/frontend/app/[locale]/*
      },

---

 This breakpoint was initially set in:

/home/xxx/workspace/my-project/frontend/app/[locale]/page.tsx line 17 column 3

 We couldn't find a corresponding source location, but found some other files with the same name:

/home/xxx/workspace/my-project/frontend/app/%5Blocale%5D/page.tsx
If this is the same file, you may need to adjust your build tool to correct the paths.

---

Docker node 22 alpine
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/PierreCavalet/turbopack-sourcemap-bug-reproduction

To Reproduce

Everything is provided in the README.md

  • clone the repository
  • install the stack
./up.sh

Go on both URLs provided in the readme and play with breakpoint. Everything should be working.

comment line 26 in .vscode/launch.json

breakpoint in [locale]/page.tsx should not be working.

Current vs. Expected behavior

I'm using next 16 (16.0.3) and turbopack through docker and docker compose in dev mode.

I've been using next since version 13 and never had any issue making debugger work through docker with webpack, using sourcemapoverrides localRoot & remoteRoot.

however now that next uses turbopack, I cannot find a suitable sourcemapoverrides, because turbopack url encodes the file path, which vscode & cursor does not seem to be able to treat.

      "sourceMapPathOverrides": {
        // Base path mappings
        "/usr/app/frontend/*": "${workspaceFolder}/frontend/*",
        "file:///usr/app/frontend/*": "${workspaceFolder}/frontend/*",

        // Turbopack protocol mappings
        "turbopack:///_N_E/*": "${workspaceFolder}/frontend/*",
        "turbopack:///./*": "${workspaceFolder}/frontend/*",
        "turbopack:///*": "${workspaceFolder}/frontend/*",

        // URL-encoded route segments (Turbopack encodes [segment] as %5Bsegment%5D)
        "file:///usr/app/frontend/app/%5Blocale%5D/*": "${workspaceFolder}/frontend/app/[locale]/*
      },

this is what I'm forced to do, but I cannot do this for everything that has brackets ...

If I disable my hardcodedsource map path override I get

 This breakpoint was initially set in:

/home/xxx/workspace/my-project/frontend/app/[locale]/page.tsx line 17 column 3

 We couldn't find a corresponding source location, but found some other files with the same name:

/home/xxx/workspace/my-project/frontend/app/%5Blocale%5D/page.tsx
If this is the same file, you may need to adjust your build tool to correct the paths.

Current behavior

I need to map every path containing brackets in my launch.json

Expected behavior

It should work without mapping it or turbopack should expose an option to not url encode its sourcemap

Provide environment information

Docker node 22 alpine

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

extent analysis

TL;DR

The most likely fix is to configure sourceMapPathOverrides in launch.json to correctly map URL-encoded file paths generated by Turbopack to local file paths.

Guidance

  • Review the sourceMapPathOverrides configuration in launch.json to ensure it correctly maps Turbopack's URL-encoded file paths to local file paths.
  • Consider using a regular expression or a more dynamic approach to handle URL-encoded paths with brackets, rather than hardcoding each possible path.
  • Verify that the launch.json configuration is being applied correctly by checking the VSCode debugger settings and the Turbopack documentation.
  • If possible, explore Turbopack options to disable URL encoding of file paths in sourcemaps.

Example

No specific code example is provided, as the issue is related to configuration and not a code snippet.

Notes

The current workaround requires manual mapping of each path containing brackets, which is not scalable. A more robust solution would involve either configuring Turbopack to not URL-encode file paths or using a dynamic approach to handle these paths in launch.json.

Recommendation

Apply a workaround by configuring sourceMapPathOverrides in launch.json to correctly map URL-encoded file paths, as a permanent solution is not currently available due to Turbopack's URL encoding of file paths.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING