缺少.map资源? [英] Missing .map resource?

查看:117
本文介绍了缺少.map资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近开始在我的所有项目中遇到这个问题。加载包含对jquery源文件的引用的索引页时,我的控制台会记录此错误: GET http:// localhost:3000 / js / lib / jquery-1.10.2.min.map 500 (内部服务器错误)



这根本不会影响我的应用程序,但是当我打开控制台时看到真的很烦人。有人知道这是从哪里来的吗?

编辑:请注意,我没有明确引用.map文件,我只是指向 < script src =js / lib / jquery-1.10.2.min.js>< / script>

解决方案

jQuery最近开始使用源地图。



例如,让我们看看缩小的jQuery 2.0.3文件的前几行。 p>

  / *! jQuery v2.0.3 | (c)2005年,2013年jQuery Foundation,Inc. | jquery.org/license 
// @ sourceMappingURL = jquery.min.map
* /

摘自 JavaScript源地图简介


你有没有发现自己希望能保持客户端的
代码可读,更重要的是可调试甚至之后
合并并缩小它,而不会影响性能?那么现在你
可以通过源地图的魔力。



基本上,这是一种将映射组合/缩小文件返回到
未建立状态
。当您为制作而构建时,随着缩小和
组合您的JavaScript文件,您将生成一个源映射,其中包含有关原始文件的
信息。当您在生成的JavaScript中查询特定行
和列号时,您可以在
中执行查找返回原始位置的源地图。开发人员工具
(当前WebKit每晚构建,谷歌浏览器或Firefox 23+)可以自动解析源映射,并使使其看起来好像您的
运行未经组合且未组合文件。


强调我的



这非常有用,只有当用户打开开发工具时才会下载。

解决方案



移除源映射行,或者什么也不做。这不是问题。






注意:你的服务器应该返回404而不是500.它可能指向如果在生产中发生这种情况,这是一个安全问题。


I've recently started having this problem with all my projects. When my index page loads which contains a reference to the jquery source file, my console logs this error: GET http://localhost:3000/js/lib/jquery-1.10.2.min.map 500 (Internal Server Error).

This doesn't affect my application at all, but it's really annoying to see whenever I open up the console. Does anyone know where this is coming from?

Edit: Note that I'm not explicitly referencing the .map file, I am just pointing to <script src="js/lib/jquery-1.10.2.min.js"></script>

解决方案

jQuery recently started using source maps.

For example, let's look at the minified jQuery 2.0.3 file's first few lines.

/*! jQuery v2.0.3 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/

Excerpt from Introduction to JavaScript Source Maps:

Have you ever found yourself wishing you could keep your client-side code readable and more importantly debuggable even after you've combined and minified it, without impacting performance? Well now you can through the magic of source maps.

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.

emphasis mine

It's incredibly useful, and will only download if the user opens dev tools.

Solution

Remove the source mapping line, or do nothing. It isn't really a problem.


Side note: your server should return 404, not 500. It could point to a security problem if this happens in production.

这篇关于缺少.map资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆