What is jQuery Source Map?

As the name suggests, it consists of a whole bunch of information that can be used to map the code within a compressed file back to it's original source . It is used by browser's debugger to help developers debug the minified version of script file. The Chrome and Firefox developer tools both ship with built-in support for source maps. It loaded only when the developer tools are active. Browsers won't load them for application's users. When you minify a file , it takes thousands of lines of pretty code and turns it into only a few lines of complex coding file. Hopefully, when you are shipping your code to production level , you are using the minified code instead of the original source. When you query a certain line and column number in your generated JavaScript you can do a lookup in the source map which returns the original location. If you didn't have the sourcemap , then any error would seem cryptic at best. The map file name is the same as the compressed version , with .map replacing .js. It should be noted that there are two types of source maps . One which is an external file and there is a link to it in the actual file and another one which is embedded in the main file. Browsers actually have to load the entire file for the second type.