Skip to content

Commit 5be590a

Browse files
committed
Strictly add comment
1 parent 8441f95 commit 5be590a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/react-error-overlay/src/utils/unmapper.js

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ async function unmap(
5656
}
5757
let { fileName } = frame;
5858
if (fileName) {
59+
// The web version of this module only provides POSIX support, so Windows
60+
// paths like C:\foo\\baz\..\\bar\ cannot be normalized.
61+
// A simple solution to this is to replace all `\` with `/`, then
62+
// normalize afterwards.
5963
fileName = path.normalize(fileName.replace(/[\\]+/g, '/'));
6064
}
6165
if (fileName == null) {
@@ -64,6 +68,7 @@ async function unmap(
6468
const fN: string = fileName;
6569
const source = map
6670
.getSources()
71+
// Prepare path for normalization; see comment above for reasoning.
6772
.map(s => s.replace(/[\\]+/g, '/'))
6873
.filter(p => {
6974
p = path.normalize(p);

0 commit comments

Comments
 (0)