Commit 634dadb4 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub
Browse files

Unmapper Windows compatibility (#3079)

* Switch to unix path separators before normalizing path for Windows compatibility

* Add comment for posterity

* Revert "Add comment for posterity"

This reverts commit 742bacee.

* Strictly add comment
parent b17fa412
Showing with 6 additions and 1 deletion
+6 -1
...@@ -56,7 +56,11 @@ async function unmap( ...@@ -56,7 +56,11 @@ async function unmap(
} }
let { fileName } = frame; let { fileName } = frame;
if (fileName) { 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) { if (fileName == null) {
return frame; return frame;
...@@ -64,6 +68,7 @@ async function unmap( ...@@ -64,6 +68,7 @@ async function unmap(
const fN: string = fileName; const fN: string = fileName;
const source = map const source = map
.getSources() .getSources()
// Prepare path for normalization; see comment above for reasoning.
.map(s => s.replace(/[\\]+/g, '/')) .map(s => s.replace(/[\\]+/g, '/'))
.filter(p => { .filter(p => {
p = path.normalize(p); p = path.normalize(p);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment