Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Source map warning on Next 15.2.4 with turbopack, Windows, Firefox #77670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pburrows opened this issue Apr 1, 2025 · 6 comments
Open

Source map warning on Next 15.2.4 with turbopack, Windows, Firefox #77670

pburrows opened this issue Apr 1, 2025 · 6 comments
Labels
Turbopack Related to Turbopack with Next.js.

Comments

@pburrows
Copy link

pburrows commented Apr 1, 2025

Link to the code that reproduces this issue

https://github.com/altbdoor/nextjs-sourcemap-warning-firefox-reproduction

To Reproduce

Create a base reproduction template with npx create-next-app -e reproduction-template
Name the project as test-ground
cd test-ground
npm run dev -- --turbo
Open http://localhost:3000/ in Windows Firefox
Get warning on source map error

Current vs. Expected behavior

Source map error: Error: Invalid URL: file://C%3A/Users/carbon/projects/test-ground/node_modules/next/src/client/app-bootstrap.ts
Stack in the worker:URLImpl@resource://devtools/client/shared/vendor/whatwg-url.js:22:13
setup@resource://devtools/client/shared/vendor/whatwg-url.js:537:14
URL@resource://devtools/client/shared/vendor/whatwg-url.js:246:18
createSafeHandler/<@resource://devtools/client/shared/vendor/source-map/lib/util.js:181:17
computeSourceURL@resource://devtools/client/shared/vendor/source-map/lib/util.js:437:22
BasicSourceMapConsumer/</that._absoluteSources<@resource://devtools/client/shared/vendor/source-map/lib/source-map-consumer.js:213:23
BasicSourceMapConsumer/<@resource://devtools/client/shared/vendor/source-map/lib/source-map-consumer.js:212:33

Resource URL: http://localhost:3000/_next/static/chunks/node_modules_next_dist_client_239c40._.js
Source Map URL: node_modules_next_dist_client_239c40._.js.map

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 16206
  Available CPU cores: 12
Binaries:
  Node: 22.11.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.2.0-canary.31 // Latest available version is detected (15.2.0-canary.31).
  eslint-config-next: N/A
  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

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

This is the same issue as this:
#73384

It was inappropriately closed and has dozens of comments on how to reproduce it. Please do not close this issue again, it is highly annoying. The reproduction steps are complete.

@github-actions github-actions bot added the Turbopack Related to Turbopack with Next.js. label Apr 1, 2025
@timneutkens
Copy link
Member

@kdy1 has landed a fix for sourcemap locations in Turbopack with Windows. Could you give next@canary a try? Want to make sure it's now fully covered.

@Andre9979
Copy link

@timneutkens works great on my end. Client-side debugging behaved as expected. Server-side wasn’t mapped correctly though, so I had to manually add the mapping to my Node attach config to get it working:

{
  "name": "Next.js: Attach Debugger to Server",
  "request": "attach",
  "port": 9230,
  "type": "node",
  "sourceMapPathOverrides": {
    "turbopack:///[project]/*": "${workspaceFolder}/*"
  }
}

After that, server-side debugging worked fine too.
Thanks @kdy1!

@kdy1 kdy1 assigned kdy1 and unassigned kdy1 May 1, 2025
@timneutkens
Copy link
Member

@Andre9979 was that on next@canary or an earlier version? Would be helpful to have a reproduction of the case where it doesn't map automatically so we can look into it.

@Andre9979
Copy link

Andre9979 commented May 8, 2025

@timneutkens Thanks for following up! I initially tested this on the version where the sourcemap fix was landed ([email protected]), but the issue with server-side code not mapping automatically still persists in [email protected] (the latest canary at the time of writing).

Environment:

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 65299
  Available CPU cores: 20
Binaries:
  Node: 23.9.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.5.2
Relevant Packages:
  next: 15.4.0-canary.27 // Latest available version is detected (15.4.0-canary.27).
  eslint-config-next: 15.3.1
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.8.3
Next.js Config:
  output: N/A

Reproduction steps:

  1. Use [email protected] or [email protected]
  2. Add the following to .vscode/launch.json:
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Next.js: Attach Debugger to Server",
      "request": "attach",
      "port": 9230,
      "type": "node"
    },
    {
      "name": "Next.js: Launch Server",
      "type": "node-terminal",
      "request": "launch",
      "command": "pnpm dev"
    }
  ],
  "compounds": [
    {
      "name": "Next.js: Launch Server Debugger",
      "configurations": [
        "Next.js: Launch Server",
        "Next.js: Attach Debugger to Server"
      ],
      "stopAll": true
    }
  ]
}
  1. Add a breakpoint in server-side code (e.g., in middleware.ts).
  2. Run the "Next.js: Launch Server Debugger" debug configuration in VS Code.
  3. Open http://localhost:3000/ in a browser.
  4. Observe: server-side breakpoints are not hit unless sourceMapPathOverrides is manually configured, as shown in my previous comment.

Current vs. Expected behavior

Expected: Server-side source maps are automatically resolved correctly, just like they are for client-side code.
Current: Server-side source maps are not correctly mapped by default and require manual configuration via sourceMapPathOverrides

@kdy1
Copy link
Member

kdy1 commented May 8, 2025

@Andre9979 Do you know if it's the same in macos or linux, in case you tried? It would be good to know if it's a windows-specific bug.

@Andre9979
Copy link

@kdy1 I’ve only tested this on windows and don’t have access to macos or linux at the moment, so I can’t confirm whether it’s windows-specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

4 participants