语法错误:Using //@ to indicate sourceURL pragmas is deprecated.Use //# instead
JavaScript 警告“不推荐使用 //@
来指示 sourceURL 编译指示。当 JavaScript 源中存在已弃用的源映射语法时,会出现“使用 //#
代替”的情况。
¥The JavaScript warning "Using //@
to indicate sourceURL pragmas is deprecated. Use //#
instead" occurs when there is a deprecated source map syntax in a JavaScript source.
信息
错误类型
¥Error type
发生 SyntaxError
的警告。JavaScript 的执行不会停止。
¥A warning that a SyntaxError
occurred. JavaScript execution won't be halted.
什么地方出了错?
¥What went wrong?
JavaScript 源代码中有一种已弃用的源映射语法。
¥There is a deprecated source map syntax in a JavaScript source.
JavaScript 源通常会被组合和缩小,以便更有效地从服务器交付它们。使用 源映射,调试器可以将正在执行的代码映射到原始源文件。
¥JavaScript sources are often combined and minified to make delivering them from the server more efficient. With source maps, the debugger can map the code being executed to the original source files.
每当在 //@cc_on
被解释为在 IE JScript 引擎中打开条件编译后在页面中找到源映射规范时,由于与 IE 发生冲突,源映射规范更改了语法。IE 中的 条件编译注释 是一个鲜为人知的功能,但它破坏了 jQuery 和其他库的源映射。
¥The source map specification changed the syntax due to a conflict with IE whenever it was found in the page after //@cc_on
was interpreted to turn on conditional compilation in the IE JScript engine. The conditional compilation comment in IE is a little known feature, but it broke source maps with jQuery and other libraries.
示例
已弃用的语法
标准语法
¥Standard syntax
请改用 "" 符号。
¥Use the "#" sign instead.
//# sourceMappingURL=http://example.com/path/to/your/sourcemap.map
或者,你可以为 JavaScript 文件设置 SourceMap
标头,以避免出现注释:
¥Or, alternatively, you can set a SourceMap
header to your JavaScript file to avoid having a comment at all:
SourceMap: /path/to/file.js.map
也可以看看
¥See also
- Firefox 源文档中的 使用源地图
- developer.chrome.com 上的 JavaScript 源映射简介 (2012)
SourceMap