Questions tagged [source-maps]

A source map allows a JavaScript debugger to map line and symbol information from a transformed (eg. minified, optimized) JavaScript file back to the original input file used for the transformation. The original file can be any kind of text file which in effect enables in-browser debugging of any language compiling to JavaScript.

JavaScript code used on websites has often gone through various stages of automated transformation (eg. minification, optimization, etc.), or have even been generated from a non-JavaScript source language targeting JavaScript as the runtime environment. These automated translations often make the final code much more difficult to understand and debug using development tools inside the browser.

Source maps solve the problem by giving the JavaScript debugger enough additional information to effectively translate locations and symbols between the processed JavaScript code and the original input file used to create it.

JavaScript source maps is a technology proposal from Google and Mozilla, and currently developed inside the Closure Compiler, WebKit, and Mozilla's DevTools.

Because source maps are not yet officially released and documented, good information about them is somewhat scarce. The following articles give an overview of the current state of source maps:

1111 questions
533
votes
5 answers

How can I use JavaScript source maps (.map files)?

Recently I have seen files with the .js.map extension shipped with some JavaScript libraries (like Angular), and that just raised a few questions in my head: What is it for? Why do the guys at Angular care to deliver a .js.map file? How can I (as a…
Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
498
votes
8 answers

what are the .map files used for in Bootstrap 3.x?

There are two files included in the CSS folder with .map file extensions. They are: bootstrap-theme.css.map bootstrap.css.map They appear to be minified files but I don't know what they are for.
wetjosh
  • 6,288
  • 4
  • 23
  • 32
392
votes
6 answers

How do I generate sourcemaps when using babel and webpack?

I want to set up a config to generate sourcemaps. I'm running webpack serve from the command line, which compiles successfully. But I really need sourcemaps. This is my webpack.config.js. var webpack = require('webpack'); module.exports = { …
user916367
137
votes
2 answers

Disable source maps in Chrome DevTools

Is there a quick way to switch from the jsx code shown in Chrome DevTools to the raw ES5 and back again?
Jack Allan
  • 14,554
  • 11
  • 45
  • 57
103
votes
9 answers

"Unknown provider: aProvider <- a" How do I find the original provider?

When I'm loading the minified (through UglifyJS) version of my AngularJS application, I get the following error in the console: Unknown provider: aProvider <- a Now, I realize that this is due to variable name mangling. The unmangled version works…
Oliver Salzburg
  • 21,652
  • 20
  • 93
  • 138
97
votes
2 answers

Sourcemaps off by one line in Chrome, with Ruby on Rails, Webpack, and React JS

I'm having an issue where the sourcemaps generated by Webpack using the inline-source-map configuration setting are off by one line when I use the Chrome devtools debugger. Webpack is set up inside a Ruby on Rails application to generate a…
96
votes
10 answers

How to disable source maps for React JS Application

My react folder structure is as below I've not used the create-react-app version. I tried using GENERATE_SOURCEMAP=false. But It didn't work. Where can I find the .map files. How can I delete those files? I cannot find a build folder. I've tried…
Bharath Pabba
  • 1,725
  • 5
  • 16
  • 24
81
votes
2 answers

Performance impact of using css / javascript source-maps in production?

Should source-maps be used in production environment? Do they provide any benefits other than debugging? Do they impact app load time due to the additional server round-trips? Are browsers smart enough to load .map assets after app is loaded and…
Ray Shan
  • 1,646
  • 3
  • 17
  • 25
78
votes
2 answers

Source maps files in production - Is it safe?

I'm using UglifyJS to minify and uglify my sources, and Sentry to report errors from my production environment. In order to get errors from Sentry, in a readable manner, I need to add source-map Is it safe to do it in production servers, or the…
Ofer Velich
  • 1,959
  • 4
  • 19
  • 24
74
votes
6 answers

file is being assigned a //# sourceMappingURL but already has one

I just notice Firefox console outputs the following error for every single .js/.coffee file in my project (even the packages). -file- is being assigned a //# sourceMappingURL, but already has one Chrome's console doesn't show anything. I tried…
Manuel
  • 10,869
  • 14
  • 55
  • 86
72
votes
1 answer

What MIME type should I use for JavaScript source-map files?

I want to add source maps to my site, but I'd like to exercise some control over how they're served. What is an appropriate MIME type to use for them? Some data The content itself is JavaScript, but not meant to be executed as such. CDN.js serves…
James A. Rosen
  • 64,193
  • 61
  • 179
  • 261
60
votes
5 answers

Less/Sass debugging in Chrome Dev Tools/Firebug

How do you guys do maintenance on CSS built with Less/Sass? One of the things I like about Dev Tools/Firebug is the ability to see the line number of a css styling. Is there a good way to do this with CSS preprocessors other than having to manually…
Dave Stibrany
  • 2,369
  • 3
  • 21
  • 21
51
votes
2 answers

Debugging typescript with source maps and webpack

I have project written in Typescript and I want to be able to debug it (either in Chrome Dev Tools or in Intellij). At first I saw that Typescript's import functionality was not supported. So I tried using Webpack along with webpack dev server but…
PentaKon
  • 4,139
  • 5
  • 43
  • 80
50
votes
3 answers

Sourcemaps are detected in chrome but original source is not loaded, using webpack-2

When running an application that is built using webpack 2, sourcemaps are detected in chrome but original source is not loaded. I'm using webpack beta21. These files used to be detected automatically, ie when a breakpoint was put in the the output…
Nikos
  • 7,295
  • 7
  • 52
  • 88
1
2 3
73 74