-
Notifications
You must be signed in to change notification settings - Fork 280
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
feat: apply pathMapping when loading sourcemaps #1241
Conversation
Introducing this might break launch configurations, where the source maps are available in the non-mapped path, but not in the mapped path, but I think that this should be a pretty rare case. |
src/adapter/sources.ts
Outdated
compiledPath: absolutePath || url, | ||
}) | ||
) { | ||
absoluteSourceMapPath = await this.sourcePathResolver.urlToAbsolutePath({ |
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.
The source map might not always exist at an absolute path on disk. For example, when using the webpack-dev-server. That would cause this to be undefined, or an invalid path.
Did the initial code pointer to making the change within the SourceMapFactory
not work out? If we make the change in there, then we could also easily add fallback logic to avoid breaking existing configurations.
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.
Used this way to keep this as much as possible like the pathMapping of the original file source. But I can give it another shot with the code points you provided tomorrow.
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.
I pushed another commit. SourceMapFactory
now tries to load from the path mapped path first, but if that's unsuccessful, loading from the original path is attempted. Also logs a trace message if this happens.
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.
Lgtm. Thanks for the tests!
Fixes #1240