emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.37k stars 3.25k forks source link

Source map ignoreList support #22172

Open dschuff opened 3 days ago

dschuff commented 3 days ago

The source map format includes an ignore list option to mark code that should be considered third-party code, e.g. for frameworks or bundler-generated code. Chrome's devtools for example will skip over such code when stepping or using the pause-on-exception feature, and will hide it from stack traces, and they recently added support for this with wasm code in addition to JS. It could be useful for Emscripten to support this feature. We could mark standard library code (and other emscripten-bundled libraries?) as third-party, and we could even mark the generated JS glue code as third-party as well. For the former I think we'd need to update the source map generator (that converts DWARF to sourcemap), perhaps with a list of paths that are known to be third-party libraries, that it would add to the ignorelist. For the latter we'd need to output an additional source map that goes with the JS glue code (since the existing one covers the wasm, not the JS glue).