You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The correct annotation would be //# sourceMappingURL=out.js.map because sourcemaps are relative to the script tag src. The same issue happens if publicPath is build or /build.
I think the correct behavior is to prepend the publicPath only if it is absolute.
When the source mapping URL is not absolute, then it is relative to the generated code’s “source origin”. The source origin is determined by one of the following cases:
If the generated source is not associated with a script element that has a “src” attribute and there exists a //# sourceURL comment in the generated code, that comment should be used to determine the source origin. Note: Previously, this was “//@ sourceURL”, as with “//@ sourceMappingURL”, it is reasonable to accept both but //# is preferred.
If the generated code is associated with a script element and the script element has a “src” attribute, the “src” attribute of the script element will be the source origin.
If the generated code is associated with a script element and the script element does not have a “src” attribute, then the source origin will be the page’s origin.
If the generated code is being evaluated as a string with the eval() function or via new Function(), then the source origin will be the page’s origin.
This closed issue is about adding an API to allow arbitrary sourcemap prefixes, but the last comment complains about a similar issue but using entryNames instead of publicPath. I could not reproduce their issue though. Allow custom source-map location #2254 (comment).
The text was updated successfully, but these errors were encountered:
When publicPath is relative, it gets prepended to the sourcemap annotation, and I think that's incorrect.
Example:
./build/
<script src="./build/out.js"/>
//# sourceMappingURL=./build/out.js.map
./build/build/out.js.map
The correct annotation would be
//# sourceMappingURL=out.js.map
because sourcemaps are relative to the script tagsrc
. The same issue happens if publicPath isbuild
or/build
.I think the correct behavior is to prepend the publicPath only if it is absolute.
Sourcemap spec: https://github.com/tc39/source-map-spec/blob/main/source-map-rev3.md
Related issues:
The text was updated successfully, but these errors were encountered: