Skip to content

Commit 97454c7

Browse files
authored
fix: not working with files with multiple extensions (#37)
1 parent bc4c96c commit 97454c7

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ const transformer = (_: ts.Program) => (context: ts.TransformationContext) => (
5252
}
5353

5454
function fileExists(s: string) {
55-
// if has extensions, file must exist
56-
if (extname(s) !== "") return existsSync(s);
57-
// else check for implicit extensions .ts, .dts, etc...
55+
// check for implicit extensions .ts, .dts, etc...
5856
for (const ext of implicitExtensions) if (existsSync(s + ext)) return true;
57+
// else if has extensions, file must exist
58+
if (extname(s) !== "") return existsSync(s);
5959
return false;
6060
}
6161

tests/__fixtures/core/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ import { A } from "@circular/a";
77
import * as path from "path";
88
import * as b from "circular/a";
99
import * as c from "../circular/a";
10+
import { myNative } from "@utils/utils.native";
1011

1112
c.A;
1213
b.A;
1314
path.sep;
15+
myNative();
1416

1517
sum.sum(2, 3);
1618

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export function myNative() {}

0 commit comments

Comments
 (0)