Support absolute file:// paths in sourceMappingURL
See original GitHub issueHi! I’m working on https://github.com/mozilla/tofino and we have some interesting requirements. It appears that we need absolute file://
paths in our sourceMappingURL
to support source maps in the (Chrome) devtools that Electron provides natively. That is, we want:
//# sourceMappingURL=file:///Users/nalexander/Mozilla/tofino/lib/main/browser.map
Unfortunately, that conflicts with source-map-support
, which doesn’t appreciate absolute paths of this kind. Would you merge a patch to handle (in Node.js only) file://
protocols?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
Which is the base url of sourcemappingurl: relative from html ...
I lookup to the specification. When the source mapping URL is not absolute, then it is relative to the generated code's “source origin”....
Read more >Relative vs absolute path for sourceMappingURL - #sentry
So my minified Javascript is located at: https://jobs.apploi.com/public/dist/index.min.js And in that file, on the last line, the following ...
Read more >SourceMap - HTTP - MDN Web Docs
A relative (to the request URL) or absolute URL pointing to a source map file. Examples. SourceMap: /path/to/file.js.map
Read more >SourceMapDevToolPlugin - webpack
Usually the #sourceMappingURL comment. [url] is replaced with a URL to the source map file. Since webpack v4.36.0, path parameters are supported: [chunk] ......
Read more >source-map-support - npm
sourceMappingURL =path/to/source.map. If multiple sourceMappingURL comments exist in one file, the last sourceMappingURL comment will be ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same issue here with source maps generated by Haxe. Please fix 😃
I got same problems with electron and found maybe easy fix?
My webpacked bundled output js has this line on end:
//# sourceMappingURL=appr.js.map
which is relative path (just file name).Problem seems to be in function:
which incorrectly extract “protocol” information from
file
param when value is likefile:///c:/dev/script1.js
(local file protocol).regex extract protocol value to
file://
instead offile:///
(missing 3rd slash). It seems that problem is in this regex:var match = /^\w+:\/\/[^\/]*/.exec(dir);
And reason why param
file
hasfile:///
protocol: Electron loads html page in renderer process from file on disk, so functionfunction wrapCallSite(frame)
getsfile:///c:/dev/script1.js
on line:var source = frame.getFileName() || frame.getScriptNameOrSourceURL();
Possible fix will be to update regex on line
var match = /^\w+:\/\/[^\/]*/.exec(dir);
to correcly matchhttp|s|file:///
protocols. Sorry i havent time now to do patch so if someone had time to do that it will be super.