Skip to content
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

Switch to unix path separators before normalizing path for Windows compatibility #3079

Merged
merged 4 commits into from
Sep 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/react-error-overlay/src/utils/unmapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,19 @@ async function unmap(
}
let { fileName } = frame;
if (fileName) {
fileName = path.normalize(fileName);
// The web version of this module only provides POSIX support, so Windows
// paths like C:\foo\\baz\..\\bar\ cannot be normalized.
// A simple solution to this is to replace all `\` with `/`, then
// normalize afterwards.
fileName = path.normalize(fileName.replace(/[\\]+/g, '/'));
}
if (fileName == null) {
return frame;
}
const fN: string = fileName;
const source = map
.getSources()
// Prepare path for normalization; see comment above for reasoning.
.map(s => s.replace(/[\\]+/g, '/'))
.filter(p => {
p = path.normalize(p);
Expand Down