fix: replace backslashes with forward slashes from resolved pa… (#11366)

* fix: replace backslashes with forward slashes from resolved path for windows environments

* add test for resolveAbsoluteRuntime under windows
This commit is contained in:
johannes
2020-04-08 15:36:55 +02:00
committed by GitHub
parent ce6cc4eb55
commit fbcb251d61
5 changed files with 92 additions and 3 deletions

View File

@@ -10,9 +10,9 @@ import { typeAnnotationToString } from "./helpers";
function resolveAbsoluteRuntime(moduleName: string, dirname: string) {
try {
return path.dirname(
resolve.sync(`${moduleName}/package.json`, { basedir: dirname }),
);
return path
.dirname(resolve.sync(`${moduleName}/package.json`, { basedir: dirname }))
.replace(/\\/g, "/");
} catch (err) {
if (err.code !== "MODULE_NOT_FOUND") throw err;