SyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead - 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.
Message
Warning: SyntaxError: Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead Warning: SyntaxError: Using //@ to indicate sourceMappingURL pragmas is deprecated. Use //# instead
Error type
A warning that a SyntaxError
occurred. JavaScript execution won't be halted.
What went wrong?
There is a deprecated source map syntax in a JavaScript source.
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.
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.
Examples
Deprecated syntax
Syntax with the "@" sign is deprecated.
//@ sourceMappingURL=http://example.com/path/to/your/sourcemap.map
Standard syntax
Use the "#" sign instead.
//# sourceMappingURL=http://example.com/path/to/your/sourcemap.map
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论