Fix require
paths in closure serialization on Windows.
We were ending up with unescaped backslashes in require paths, which was causing the requires to fail.
This commit is contained in:
parent
8d7a87f694
commit
8fd2d3e9e0
1 changed files with 2 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import * as crypto from "crypto";
|
import * as crypto from "crypto";
|
||||||
import { relative as pathRelative } from "path";
|
import { relative as pathRelative } from "path";
|
||||||
|
import { sep as pathSep } from "path";
|
||||||
import * as ts from "typescript";
|
import * as ts from "typescript";
|
||||||
import * as log from "../log";
|
import * as log from "../log";
|
||||||
import { debuggablePromise } from "./debuggable";
|
import { debuggablePromise } from "./debuggable";
|
||||||
|
@ -245,7 +246,7 @@ function findRequirableModuleName(obj: any): string | undefined {
|
||||||
if (require.cache[path].exports === obj) {
|
if (require.cache[path].exports === obj) {
|
||||||
// Rewrite the path to be a local module reference relative to the
|
// Rewrite the path to be a local module reference relative to the
|
||||||
// current working directory
|
// current working directory
|
||||||
const modPath = pathRelative(process.cwd(), path);
|
const modPath = pathRelative(process.cwd(), path).replace(/\\/g, "\\\\");
|
||||||
return "./" + modPath;
|
return "./" + modPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue