Is it possible to configure Karma to use source map files for stacktraces? I see that there are a few issues on GitHub which appear to have been closed? I can't however find any example of doing so.
If this is supported can someone illustrate an example config?
A source map is a file that maps from the transformed source to the original source, enabling the browser to reconstruct the original source and present the reconstructed original in the debugger.
Explanation: TypeScript Map files are source map files that let tools map between the emitted JavaScript code and the TypeScript source files that created it. And these Source Map files will then help to debug the Typescript file instead of debugging the emitted JavaScript file.
In your karma.config.js file add
config.set({
files: [{
pattern: '**/*.js.map',
included: false
},
...
});
This has worked for me, and files are now served by karma.
You need a preprocessor to look at source maps in karma: have a look at karma-sourcemap-loader
to preprocess your data and locate the source map files.
A limitation of the library is that the source maps must be in the same folder as the js files, with the same name - but different extension of course.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With