我看到错误消息关于一个文件,min.map,没有找到:

jQuery的jQuery -1.10.2.min。map正在触发404(未找到)


截图

这是怎么回事?


当前回答

如果你想获得不同版本的源地图文件,可以使用这个链接 http://code.jquery.com/jquery-x.xx.x.min.map

相反,x.xx.x输入您的版本号。

注意:一些链接,你得到这个方法,可能是坏的:)

其他回答

假设你已经检查了文件是否存在于服务器上,这也可能是由于你的web服务器限制了文件类型:

在Apache中,这可以通过<FilesMatch>指令来完成,如果你使用mod_rewrite的话,可以使用RewriteRule。 在IIS中,您需要访问Web。配置文件。

jQuery 1.11.0/2.1.0的// sourceMappingURL注释不包含在压缩文件中。

我也遇到过同样的问题。我的原因是Grunt连接了我的JavaScript文件。

我使用了一个;\n作为分隔符,导致源路径映射到404。

所以dev tools在找jquery。min。map;而不是jquery.min.map。

我知道这不是最初问题的答案,但我确信还有其他人具有类似的Grunt配置。

可以通过删除该行来删除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)

下载地图文件和jQuery的非压缩版本。 把它们和缩小版放在一起: 包括缩小版本到你的HTML: 登录谷歌Chrome浏览器: 阅读JavaScript源映射介绍 熟悉调试JavaScript