The good news is that developers can use source maps to map transpiled code back to their original source code. When source maps are configured properly, web browsers and observability tools convert stack traces, source files, and other valuable debugging information into their original form.
This all hinges on setting up source maps correctly, which can be more challenging than you’d expect. Below are five tips to help developers get source maps working so they can spend less time debugging and more time doing what they love: writing software.
Actually generate a source map
For example, if your original source code is in TypeScript, you can use the TypeScript compiler to generate an accompanying source map during compilation.
$ tsc example.ts --outFile=example.js --source-map