Skip to content

Commit 5f23889

Browse files
committed
feat: match wildcards
1 parent 8accca3 commit 5f23889

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@ export const resolveTypescriptPaths = (options: Options = {}) => {
66
return {
77
name: 'resolve-typescript-paths',
88
resolveId: (importee: string, importer: string) => {
9-
if (!compilerOptions.paths || !compilerOptions.paths[importee]) {
9+
if (!compilerOptions.paths) {
10+
return null;
11+
}
12+
13+
const hasMatchingPath = Object.keys(compilerOptions.paths).some(path =>
14+
new RegExp(path.replace('*', '\\w*')).test(importee),
15+
);
16+
17+
if (!hasMatchingPath) {
1018
return null;
1119
}
1220

0 commit comments

Comments
 (0)