What is a source map file? The source map file is a metadata file that replaces the corresponding variable name and the location of the variable after the JS file is compressed, and generally this file is placed in the same directory as the min.js master file. For example, the original variable after compression is map, and after compression, it may be replaced with a by the variable replacement rule, at this time, the source map file will record the information of this mapping, which is the advantage that when debugging, if there are some JS errors, then the browser will remerge the compressed js by parsing the map file, so that developers can use the code before compression to debug, which will bring us great convenience! And this kind of reductive debugging function, currently only chorme has, so there will be a problem with the title, when I introduced the jquery-1.10.2.min.js, it is good under Firefox or other browsers, and it will be reported that it cannot find the jquery-1.10.2.min.map file under chorme, 404, because of the above situation, jquery will detect whether the browser supports the source map function If it is supported, then download the source map file, and at this time if you are referring to the official website min.js then no problem, it will go to its own directory to find the source map file, and if the jquery.min.js file is on your server and there is no source map on the server, then it will be reported incorrectly!
Three solutions:
1. Quote the official website documents 2. Download the source map file and put it on the server (recommended) 3. Check the chorme file tool > developer tools -> settings -> Enable source maps, remove this check, jquery will not download the source map file!
|