Menu

Chris’ Corner: Sourcemaps – CodePen

CodePen·Chris Coyier·about 5 hours ago
#wiuIVAIB
#codepen#code#sourcemaps#javascript#browser
Reading 0:00
15s threshold

Sourcemaps aren’t new, but they’re still fascinating. Neciu Dan recently wrote a good overview article .

The CSS and JavaScript we write are likely processed before they become the CSS and JavaScript sent over the internet to a browser. An obvious one is that you might author TypeScript, which is then processed into JavaScript, then bundled, then minified, and that’s what the browser actually gets.

Then let’s say there is a runtime error in that JavaScript. Without a sourcemap, all the browser can say is it looks like it’s on line 1 (because there are no line breaks in minified JavaScript, really) of app.js (or whatever your bundle is called). And it will point to some obfuscated code like function c(o,e){return 5+.5*e} — pretty useless.

At least in development, you probably want sourcemaps.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.