-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Embed source files in source map file #22189
Comments
I think the normal way that folks deal with this issue it to use path substitution and server the sources form localhost: https://developer.chrome.com/blog/wasm-debugging-2020. Embedding the all of the source files in the source map seems like it could lead to absolutely enourmous source maps so I'm not sure we would want to make that the default. @dschuff @pfaffe @RReverser WDYT? |
I am compiling a JavaScript library for npm. I want the source map to also work for downstream users when someone develops a website using the library. Users of the library probably won't bother to copy files out of node_modules/ to serve them for their source maps and they definitely won't bother with writing paths out in Chrome settings. They'll just use the library without source maps, so the choice is really between absolutely enormous source maps or no source maps. As a datapoint, the sourcesContent for me would be 800KB, less than the 1MB wasm file. $ cat $(jq -r '.sources[]' tree-sitter.wasm.map) | wc -c
847334
$ wc -c tree-sitter.wasm
1055249 tree-sitter.wasm |
(Sorry, the wasm-debugging link I sent above was for DWARF debugging. It probably not relevant to source map debugging) |
The request makes sense in general, but don't make it the default. As default, it could cause quite the surprise for any user who doesn't want to ship their sources. |
What's the point of making a source map with |
I want to generate a source map when compiling my C code that includes all the source files in the source map file itself instead of having to serve all the source code files alongside the source map file. This can be done by adding a
sourcesContent
key to the source map file. Otherwise I would have to upload 93 C files to npm with my JavaScript library.wasm-sourcemap.py includes support for doing this already with the
--sources
argumentemscripten/tools/wasm-sourcemap.py
Line 37 in b3c2567
but there's no way to pass that argument from the
emcc
commandemscripten/tools/building.py
Lines 1107 to 1111 in b3c2567
This could be a
-gsource-maps-with-contents
option or-gsource-map -s EMIT_SOURCE_CONTENTS
. But neither seems ideal, I honestly expected this would be the default behavior and how source map files would work. Copying C files to serve them over HTTP on your domain just for this is weird. The source map file should just provide the source...tree-sitter/tree-sitter#3381
The text was updated successfully, but these errors were encountered: