Skip to content
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

Incorrect sourceMappingURL added to generated server bundle prevents debugging #367

Closed
kiliman opened this issue Nov 5, 2021 · 10 comments · Fixed by #2065
Closed

Incorrect sourceMappingURL added to generated server bundle prevents debugging #367

kiliman opened this issue Nov 5, 2021 · 10 comments · Fixed by #2065
Labels
bug Something isn't working

Comments

@kiliman
Copy link
Collaborator

kiliman commented Nov 5, 2021

Updated my gist with patch to use sourcemap: 'inline'. This solves the issue.

Here's the gist:
https://gist.github.com/kiliman/a9d7c874af03369a1d105a92560d89e9

@ryanflorence
Copy link
Member

I've also confirmed it's using the remix publicPath to generate that URL, which isn't right, but since we don't get to configure the path in esbuild (we just say sourcemap: true) we might want to either:

  1. use "inline" for the server build
  2. use "external" for the server build and then append the URL ourselves

Or there's some configuration that I'm unaware of that we're doing wrong in our esbuild server bundle.

@zigomir
Copy link

zigomir commented Dec 1, 2021

Pasting this here for context: evanw/esbuild#1290

Changing sourcemap: true, to sourcemap: 'inline', in createServerBuild` works. If I open PR for it is it something you'd accept?

@kiliman
Copy link
Collaborator Author

kiliman commented Dec 8, 2021

I've updated my gist to add a patch for sourcemap to inline. Hopefully the PR will make it in.

https://gist.github.com/kiliman/a9d7c874af03369a1d105a92560d89e9

@kiliman
Copy link
Collaborator Author

kiliman commented Mar 18, 2022

Yes, PR #2065 fixes this as well as enables breakpoint debugging without any hacks.

@connor4312
Copy link

connor4312 commented Mar 26, 2022

By the way, you can also make breakpoints work by doing something like this in your launch.json within VS Code:

    {
      "type": "node-terminal",
      "request": "launch",
      "name": "Launch Server",
      "command": "npm run dev:remix",
      "skipFiles": ["<node_internals>/**"],
      "sourceMapPathOverrides": {
        "route:*": "*" // <-- fix up the paths, so route:<path> just becomes <path>
      },
      "outFiles": ["${workspaceFolder}/build/**/*.js"]
    },

    {
      "name": "Launch Client",
      "request": "launch",
      "type": "msedge",
      "url": "http://localhost:3000",
      "webRoot": "${workspaceFolder}/public/build" // tell the debugger that relative sourcemaps paths should be resolved from here
    }

Aside from having to fix the route: this is fairly 'idiomatic', though not easy to discover unless you're a sourcemapexpert... microsoft/vscode-js-debug#1214

@kiliman
Copy link
Collaborator Author

kiliman commented Mar 28, 2022

Thanks. TIL

@MichaelDeBoey MichaelDeBoey added the bug Something isn't working label Mar 29, 2022
@machour
Copy link
Collaborator

machour commented Mar 31, 2022

Fixed in #2065 🎉

@machour machour closed this as completed Mar 31, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2022

🤖 Hello there,

We just published version v1.3.5-pre.0 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@heiso
Copy link

heiso commented Apr 29, 2022

Hi there ! Thanks for the amazing work.

Where can i find the documentation about enabling sourcemaps in dev mode ?

I'm trying things but nothing seems to work T_T

@kiliman
Copy link
Collaborator Author

kiliman commented Apr 29, 2022

@heiso Are you on the latest Remix? Sourcemaps should automatically generate in development. You have to opt-in to sourcemaps for production remix build --sourcemap

They removed the sourcemap option in remix.config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
7 participants