Wrangler: [dev] display source mapped line numbers

Created on 11 Dec 2019  路  6Comments  路  Source: cloudflare/wrangler

@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

@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.

category - feature status - needs design subject - wrangler dev

Most helpful comment

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

All 6 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This would be a very welcome feature 馃挴

Not using sourcemaps makes working with workers harder than it has to be.

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.

@xtuc would we need cloudflared for that to expose the local source map to the public internet?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

matthew-petrie picture matthew-petrie  路  4Comments

RaniSputnik picture RaniSputnik  路  5Comments

xtuc picture xtuc  路  4Comments

autarc picture autarc  路  4Comments

tibotiber picture tibotiber  路  6Comments