Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Strictly add comment
  • Loading branch information
Timer committed Sep 6, 2017
commit 5be590a108f9fe5f18eabb7ff916f72f4bae7229
5 changes: 5 additions & 0 deletions packages/react-error-overlay/src/utils/unmapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ async function unmap(
}
let { fileName } = frame;
if (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, '/'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to add a comment for why it helps.

}
if (fileName == null) {
Expand All @@ -64,6 +68,7 @@ async function unmap(
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