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?

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

推荐答案

jQuery最近开始使用源映射.

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

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

摘自Introduction to JavaScript 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地雷

它非常有用,只有在用户打开开发工具时才会下载.

Solution

删除源映射线,或不执行任何操作.这其实不是什么问题.


附注:您的服务器应该返回404,而不是500.如果在生产中发生这种情况,可能会指出安全问题.

Jquery相关问答推荐

在 JQuery DataTable 中通过按钮单击传递 ID

为什么我不能在 window.onload 事件的处理程序中将 $ jQuery 对象作为参数传递?

获取 html 元素的 onclick 事件的 data-* 属性

在正则表达式字符括号中包含连字符?

将一个类动态添加到 Bootstrap 的popover容器中

如何使用 jQuery 搜索 JSON 树

了解 Backbone.js REST 调用

Jquery .on('scroll')在滚动时不触发事件

根据属性'data-sort'对jQuery中的div进行排序?

获取元素的底部和右侧位置

在jQuery中添加ID?

用 Javascript 加载 jQuery 并使用 jQuery

Jquery:如何判断元素是否具有某些 css 类/样式

将片段添加到 URL 而不导致重定向?

使用 jQuery 比较两个 Javascript 对象数组

jQuery位置href

jQuery - 从元素内部 Select 元素

一起使用 JQuery-Mobile/Phonegap 的正确方法?

粘性侧边栏:向下滚动时固定在底部,向上滚动时固定在顶部

jquery $(window).height() 正在返回文档高度