diff --git a/packages/react-error-overlay/src/utils/unmapper.js b/packages/react-error-overlay/src/utils/unmapper.js index 524b5258752..40f4528c0e4 100644 --- a/packages/react-error-overlay/src/utils/unmapper.js +++ b/packages/react-error-overlay/src/utils/unmapper.js @@ -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) { @@ -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);