Skip to content

Commit

Permalink
fix: Resolver now always converts backslash to slash. close #1
Browse files Browse the repository at this point in the history
  • Loading branch information
OniVe committed Mar 2, 2019
1 parent 9792f50 commit 625a721
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Используйте IntelliSense, чтобы узнать о возможных атрибутах.
// Наведите указатель мыши, чтобы просмотреть описания существующих атрибутов.
// Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug specs",
"env": {},
"args": ["./spec/src/main.spec.ts"],
"runtimeArgs": ["--nolazy", "-r", "ts-node/register"],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"protocol": "inspector"
}
]
}
6 changes: 1 addition & 5 deletions spec/src/main.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { promises } from "fs";
import { join, resolve, sep } from "path";
import { join, resolve } from "path";
import compile from "../helpers/compile";
import { baseUrl, outDir as actualPath } from "../helpers/config";

Expand All @@ -14,10 +14,6 @@ async function assertFilesEqual(fileName: string) {
promises.readFile(join(expectPath, fileName), { encoding: "utf8" })
]);

if (sep === "\\") {
actualRaw = actualRaw.replace(/\\\\/g, "/");
}

expect(actualRaw).toEqual(expectRaw);
}

Expand Down
4 changes: 3 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
stripWildcard
} from "./utils";

const REGEXP_ALL_BACKSLASH = /\\/g;

export interface ITransformerOptions {}

export class ProjectOptions {
Expand Down Expand Up @@ -71,7 +73,7 @@ export class PathAliasResolver {
relativePath = "." + path.sep + relativePath;
}

return relativePath;
return relativePath.replace(REGEXP_ALL_BACKSLASH, "/"); //;
} else {
return requestedModule;
}
Expand Down

0 comments on commit 625a721

Please sign in to comment.