Skip to content

Commit

Permalink
Strictly add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Sep 6, 2017
1 parent 8441f95 commit 5be590a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/react-error-overlay/src/utils/unmapper.js
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, '/'));
}
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

0 comments on commit 5be590a

Please sign in to comment.