What is the base url of sourcemappingurl: relative to html or js?

Suppose there is a js file in the html subdirectory of the file with the source map.

  • index.html (uses js / myjs.js)
  • js / myjs.js
  • JS / myjs.js.map

then what is the comment sourceMappingURL myjs.js?

//# sourceMappingURL=myjs.js.map

or

//# sourceMappingURL=js/myjs.js.map
+4
source share
1 answer

I look at the specification .

When the source mapping URL is not absolute, this refers to the generated source of origin codes. The source of origin is determined by one of the following cases:

  • script, "src" # sourceURL # , . . "//@sourceURL", "//@ sourceMappingURL ", , // # is .
  • script script "src", "src" script .
  • script, script "src", .
  • eval() (), .

, <script src="js/myjs.js"> index.html, js/myjs.js.map.

+2

Source: https://habr.com/ru/post/1648191/


All Articles