[dev] display source mapped line numbers
See original GitHub issue@xtuc has a WIP PR that would add sourcemaps to anything published with wrangler. we should utilize these maps in wrangler dev
. @xtuc has already implemented source maps in the devtools protocol - the source map is accessible as base64 encoded json
Possible implementations
- Implement in the runtime
- JavaScript implementation
- probably easier
- C++/KJ implementation
- possibly more performant
- JavaScript implementation
@xtuc would need to talk with runtime team about how we would possibly move forward with this approach. He noted a possible concern with regards to leaking meaningful stack traces in response bodies.
- Implement everything in Wrangler
- could parse base64 sourcemap from devtools and compute accurate line numbers from lineNumber and columnNumber fields from devtools
- alternatively could read in source map from webpack config and not worry about base64 and compute accurate line numbers from lineNumber and columnNumber fields from devtools protocol
This approach is probably the easiest but would require any new clients to also implement their own source map handling approach. My guess is that long term we probably want the runtime to support this.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:18
- Comments:12 (3 by maintainers)
Top Results From Across the Web
How can I get the original line number and symbol from a ...
Show activity on this post. I have found the answer using this npm module: https://www.npmjs.org/package/source-map. Edit Feb 1st, 2015.
Read more >How to use source maps for essential debugging - CodeSignal
In this engineering blog post we explain how we source maps can be used for debugging, for example between TypeScript and transpiled JS....
Read more >Webpack from Nothing - Stack Traces and Line Numbers that ...
The main disadvantage is that it doesn't display line numbers correctly. Like…why am I using source maps if I am also OK with...
Read more >Introduction to JavaScript Source Maps - Chrome Developers
Select "Get original location" will query the source map by passing in the generated line and column number, and return the position in...
Read more >Debugging JavaScript with Source Maps - Rollbar
Generating a Source Map; How do Source Maps Work? ... Here we can see the proper source code with files, line numbers from...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think stale bot might have been a bit too keen to close this issue. I would still very much like to have source maps for my worker scripts
In wrangler dev we should make webpack always generate a sourcemap, serve it with a new local HTTP server and inject a
sourceMappingURL
in the worker that points locally.When the worker runtime will load the worker it will send that source map URL to the devtools that it can download from the user endpoint.