Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is jQuery source map loaded?

I have downloading the latest jQuery version "jQuery 1.10.2" and since then I am getting the following error in Chrome:

/jquery-1.10.2.min.map 404 (Not Found)

In order to fix this, I have found the issue report where it is explain that there is a source map file use for debugging.

One of the possible fixes is to deleted the comment in jQuery js where the file is included and other is to download the map file.

My questions is, if the source map file can be useful and help me debug, when it is loaded because if it is loaded each time when my jQuery is loaded, then why to use min version of the library, as this source map is bigger as the uncompressed version?

like image 493
gotqn Avatar asked Sep 05 '13 07:09

gotqn


1 Answers

The source map file is used by chrome debugger to help developers debug the minified script file...

The idea is when you build for production, along with minifying and combining your JavaScript files, you generate a source map which holds information about your original files. 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. The DevTools can parse the source map automatically and make it appear as though you're running unminified and uncombined files.

read more here

So the map file is loaded only when the debugger is active... meaning the file will be loaded only on dev environment not in the users systems

like image 95
Arun P Johny Avatar answered Oct 04 '22 19:10

Arun P Johny