如何在加载 jquery-migrate.min.js 时消除错误 "Unsupported format of the sourcemap"?

How can I get rid of the error "Unsupported format of the sourcemap" while loading jquery-migrate.min.js?

我在 Visual Studio 2013 调试 window 中收到以下错误消息:

'iexplore.exe' (Script): Loaded http://localhost:4453/Scripts/lib/jquery-migrate.min.js

Unsupported format of the sourcemap

模块加载消息已打开(调试 window 上下文菜单)。我知道应该有一个 jquery-migrate.min.js.map 文件,但不幸的是 jQuery队.

现在我尝试简单地使用一个空文件,我也尝试使用 jquery.min.map 文件(只是将副本重命名为 jquery-migrate.min.js.map),但是两者都没有没用。

我也查看了 jQuery 站点,他们为 Jquery 提供了地图文件,但 没有 为 jquery-migrate: Download the map file for jQuery 2.1.4

由于该文件无法下载(或者我看错了位置),我该如何从头开始创建这样的文件?它看起来像一个 JSON 格式的文件。

注意:@Whosebug 提供了一些关于站点地图文件的信息(参见 bootstrap-3-1-1-what-is-the-map-extension-file-used-for). And to give you an idea about the syntax of sourcemaps, you can read this: Source Map Revision 3 Proposal

不幸的是,试图通过使用提案中的信息来模仿 sourcemap 并没有帮助,错误消息仍然显示。

我尝试在与缩小文件 jquery-[=71 相同的路径中创建文件 jquery-migrate.min.js.map =]:

{"version":3, "file":"jquery-migrate.min.js", "sources":["jquery-migrate.js"], "names":["$"],"mappings":";EAAIzkC"}

(不知道映射代码是如何计算的)

不幸的是,这没有帮助。

然后我认为它可以通过以下方式更改文件jquery-migrate.min.js来抑制错误消息:

即,我注释掉了行

//@ sourceMappingURL=dist/jquery-migrate.min.map

所以文件现在看起来像这样(为了便于阅读,下面的代码被截断了,只需注意最后一行 /*---disabled: //@ sourceMappingURL=dist/jquery-migrate.min.map ---*/):

/*! jQuery Migrate v1.1.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */ jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){o[n]||(o[n]=!0,e.migrateWarning....................

/---disabled: //@ sourceMappingURL=dist/jquery-migrate.min.map ---/

但是错误信息还是出现了。 Astro 给了我正确的提示(见他的回答)。谢谢!


注意(对更改上述消息的审阅者):这是 Visual Studio 抛出的错误消息,link 是本地 link指向我的 IISExpress。不要更改错误消息。

jquery-migrate.min.js.map 在那里,因此您可以调试 jquery 缩小的库。它需要用于开发目的,但对于生产,您不需要整条线。我不知道他们为什么在 js 中包含该行。

您可以安全地删除整行。

我不知道 VS2013,但对于我的 php 项目,我 运行 在文件 jquery.js 上执行 gulp 任务以在与其他 js 库连接之前删除此行,