fix: typegen stable path generation with Windows (#400)

* fix: typegen stable path generation with Windows

When using Windows, rootTypings paths are using `\` instead of `/` in generated code. This commit fixes it.

* Replace all Windows path separators in rootTypings

Co-authored-by: Tim Griesser <tgriesser10@gmail.com>
This commit is contained in:
Julien Blatecky 2020-04-02 15:49:36 +02:00 committed by GitHub
parent a10463e77c
commit 035e0a1092
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -170,7 +170,9 @@ export class TypegenPrinter {
const importPath = (path.isAbsolute(val.path)
? relativePathTo(val.path, outputPath)
: val.path
).replace(/(\.d)?\.ts/, "");
)
.replace(/(\.d)?\.ts/, "")
.replace(/\\+/g, "/");
importMap[importPath] = importMap[importPath] || new Set();
importMap[importPath].add(
val.alias ? `${val.name} as ${val.alias}` : val.name