sourceMappingURL and sourceURL syntax changed

If you use either source maps or sourceURL (both covered in thisprimer on source maps), then you may see a warning in Chrome console like"/*@ sourceMappingURL=" source mapping URL declaration is deprecated, "/*# sourceMappingURL=" declaration should be used instead.

Sourcemapping Devtools screenshot

Here's what that's about:

Impetus

//@ sourceMappingURLwas found to have a conflict with IE whenever it wasfound in the page after//@cc_on was interpreted to turn on conditionalcompilation in the IE JScript engine. A legacy version of the HTML5 Shiv is oneparticular offender here.

Spec Change

The//@ sourceMappingURL syntax is defined in theSourcemap V3 specIt was changed there to use//# syntax instead.

sourceURL

//@ sourceURL is also defined in the spec and was made to match the//# syntaxfor consistency. Follow through, for details onwhat sourceURL does. It's used by Ember'sminispade, Google'sconcatenate.js, and others. In Chrome,sourceURL is supported for inline scripts and inline styles, in addition to evaluated JS.

Implementation in Browser DevTools = done!

  • Safari Inspector now supports//# for sourceMappingURL and sourceURL
  • Firebug's changehas landedfor sourceURL.
  • Firefoxlanded the change forsourceMappingURL. The sourceURLticket is here.
  • ChromeDevToolslanded the change for sourceMappingURL andsourceURL. It will also warn about use of the deprecated//@ syntax.

While these changes make their way to stable release, you can use both syntaxes simultaneously for full tool support or migrate immediately to the# syntax, depending on your needs.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2013-06-12 UTC.