Hi,
When I compile my project with -s WASM=1 the//# sourceMappingURL= is missing in the .js file. But the .map file is generated correctly.
I have no problem when I compile to asm.js.
emcc (Emscripten gcc/clang-like replacement) 1.37.22 (commit d3a5609c5f1cf786de9e205a154e1ffacd80a173)
The source map integration stuff should be in the wasm file, not the JS, I believe, when building to wasm. cc @yurydelendik to make sure.
The WebAssembly source maps proposal is at https://github.com/WebAssembly/design/pull/1051 . The source map can be referenced from the WASM file itself.
See also examples at https://github.com/yurydelendik/sqlite-playground/blob/master/Makefile (demo at https://yurydelendik.github.io/sqlite-playground/src/playground.html) and https://github.com/yurydelendik/old-man-sandbox/tree/master/rust-wasm-hey (demo at http://yurydelendik.github.io/old-man-sandbox/rust-wasm-hey/hey.html)
OK, thanks. After taking a look of the hexdump of my .wasm file, I see trace of sourceMappingURL, but is there an option to set this URL when I compile?
I think --source-map-base does that.
Perfect, thanks for your help. It seems only Firefox Developer Edition can handle source map reference from .wasm? I was not able to see my C++ files in Chrome or standard Firefox.
It's better to fill sourcesContent with real file content as it done in rust sample.
just compare files from emscripten with C
https://yurydelendik.github.io/sqlite-playground/build/playground.wasm.map
and rust
https://yurydelendik.github.io/old-man-sandbox/rust-wasm-hey/hey.wasm.map
rust has sourcesContent section
May be it is some additional flag or something similar for that
@yurydelendik is it some kind of magic how do you fill sourcesContent section?
Currently, this feature still only working on Firefox Developer Edition.
Most helpful comment
Currently, this feature still only working on Firefox Developer Edition.