Skip to content

Commit

Permalink
fix(register): support paths alias with baseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
minh-hoang-trinh authored and Brooooooklyn committed Sep 22, 2022
1 parent 1606f3c commit 2a6848a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/register/read-default-tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ export function tsCompilerOptionsToSwcConfig(options: ts.CompilerOptions, filena
dynamicImport: true,
esModuleInterop: options.esModuleInterop ?? false,
keepClassNames: true,
paths: options.paths as Options['paths'],
paths: Object.fromEntries(
Object.entries(options.paths ?? {}).map(([aliasKey, aliasPaths]) => [
aliasKey,
(aliasPaths as string[] ?? []).map((path) => resolve(options.baseUrl ?? './', path)),
]),
) as Options['paths'],
}
}

0 comments on commit 2a6848a

Please sign in to comment.