Skip to content

Commit dd57089

Browse files
committed
1 parent 0ec7984 commit dd57089

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ const transformer = (_: ts.Program) => (context: ts.TransformationContext) => (
3434
}
3535

3636
function bindModuleToFile(moduleName: string) {
37+
if (moduleName[0] === ".") {
38+
// if it's relative path do not transform
39+
return moduleName;
40+
}
3741
for (const { regexp, path } of binds) {
3842
const match = regexp.exec(moduleName);
3943
if (match) {

tests/__fixtures/core/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { subs, NoRuntimecodeHere } from "@utils";
55
import "@circular/b";
66
import { A } from "@circular/a";
77
import * as path from "path";
8+
import * as b from "circular/a";
9+
import * as c from "../circular/a";
810

11+
c.A;
12+
b.A;
913
path.sep;
1014

1115
sum.sum(2, 3);

tests/__fixtures/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"baseUrl": "./",
1010
"paths": {
1111
"path": ["https://external.url/path.js"],
12-
"@*": ["*"]
12+
"@*": ["*"],
13+
"*": ["*"]
1314
},
1415

1516
"esModuleInterop": true,

tests/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ function update(content: string, sourceDir: string) {
2121
.replace(/"(@.*)"/g, (_, moduleName) => {
2222
return `"${bindModuleToFile(moduleName, sourceDir)}"`;
2323
})
24-
.replace('"path"', '"https://external.url/path.js"');
24+
.replace('"path"', '"https://external.url/path.js"')
25+
.replace('"circular/a"', '"../circular/a"');
2526
}
2627

2728
function bindModuleToFile(moduleName: string, sourceDir: string) {

0 commit comments

Comments
 (0)