-
-
Notifications
You must be signed in to change notification settings - Fork 84
fix(index): resolve source maps with root-relative paths correctly #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(index): resolve source maps with root-relative paths correctly #68
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. May you add a test case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me.
Excellent! Can this get merged in? How frequently do you guys release this package? |
@d3viant0ne Could you help to merge it? |
@d3viant0ne can you take a look at this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iclanton Thx
Released in |
Thanks! |
source-map-loader
doesn't correctly handle sourcemaps with root-relativesourceRoot
properties in sourcemaps.Consider the following example sourcemap:
source-map-loader
will resolve each of the files referenced insources
to be undersourceRoot
here (so in this example, the path becomes/code/my-project/src//my-file.ts
), and then it will attempt to resolve each of the paths it constructed usingloaderUtils.urlToRequest
. As per the documentation ofurlToRequest
, theroot
argument is required for paths that are root-relative. Root-relative paths work correctly on Windows because of this condition, but on UNIX and UNIX-like operating systems, without theroot
argument, this condition applies. This means, the path in our example above is turned into.//code/my-project/src//my-file.ts
, which isn't a valid path.This issue is easily fixed by passing
true
to theroot
parameter ofurlToRequest
, which causes paths with a leading/
to be passed through (this condition).