Skip to content

Commit

Permalink
Merge pull request #666 from terceser/support-paths-base-url
Browse files Browse the repository at this point in the history
fix(register): support paths alias with baseUrl
  • Loading branch information
Brooooooklyn committed Sep 20, 2022
2 parents 9993917 + 542f166 commit 2de6a16
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/register/read-default-tsconfig.ts
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 2de6a16

Please sign in to comment.