我看到错误消息关于一个文件,min.map,没有找到:
jQuery的jQuery -1.10.2.min。map正在触发404(未找到)
截图
这是怎么回事?
我看到错误消息关于一个文件,min.map,没有找到:
jQuery的jQuery -1.10.2.min。map正在触发404(未找到)
截图
这是怎么回事?
当前回答
假设你已经检查了文件是否存在于服务器上,这也可能是由于你的web服务器限制了文件类型:
在Apache中,这可以通过<FilesMatch>指令来完成,如果你使用mod_rewrite的话,可以使用RewriteRule。 在IIS中,您需要访问Web。配置文件。
其他回答
下载地图文件和jQuery的非压缩版本。 把它们和缩小版放在一起: 包括缩小版本到你的HTML: 登录谷歌Chrome浏览器: 阅读JavaScript源映射介绍 熟悉调试JavaScript
jQuery的新版本需要这个文件http://code.jquery.com/jquery-1.10.2.min.map
此文件的可用性描述在http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/
更新:
jQuery 1.11.0/2.1.0
// sourceMappingURL注释不包含在压缩文件中。
可以通过删除该行来删除404
//@ sourceMappingURL=jquery-1.10.2.min.map
从jQuery文件的顶部。
jQuery文件的顶部看起来像这样。
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map
*/
把它改成
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license */
源映射的目的
Basically it's a way to map a combined/minified file back to an unbuilt state. 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. Developer tools (currently WebKit nightly builds, Google Chrome, or Firefox 23+) can parse the source map automatically and make it appear as though you're running unminified and uncombined files. (Read more on this here)
根据我对浏览器的理解,至少Chrome,默认情况下不会禁用源映射。这意味着应用程序的用户将在默认情况下触发此源映射请求。
您可以通过删除//@ sourceMappingURL=jquery.min来删除源映射。映射你的JavaScript文件。
jQuery 1.11.0/2.1.0的// sourceMappingURL注释不包含在压缩文件中。