this post was submitted on 14 Oct 2023
923 points (97.2% liked)
Programmer Humor
32721 readers
361 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Can you give us an eli5 on sourcemaps?
Usually when code is minified, it is shipped alongside a sourcemap (*.js.map), which can be used by the browser to show you the original code.
If you get an error in the browser, you can click the error, which will take you to the network(?) tab and show you exactly where the error occurred
Also when code has been compiled, or transpiled. The reason the line numbers don't match is because all of the code is being assembled into one large package and served to whatever client uses it. So even if you don't minify, but you're compiling, sourcemaps will show you where the error actually occurs, instead of where it occurs in the finished product.
Especially if the compiler optimization options inlined code from 5 different places into one blob