Skip to content

feat(jsii): allow specifying baseUrl and paths in tsconfig.json #3662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ are set in the `jsii.tsc` section of the `package.json` file, but use the same n
default, all visible `@types/*` packages will be loaded, which can be undesirable (in particular in monorepos, where
some type libraries are not compatible with the TypeScript compiler version that `jsii` uses). The value specified
here will be forwarded as-is to the TypeScript compiler.
- `baseUrl` and `paths` can be used to configure TypeScript path mappings, and are copied verbatim to `tsconfig.json`.

Refer to the [TypeScript compiler options reference][ts-options] for more information about those options.

Expand Down
5 changes: 5 additions & 0 deletions packages/jsii/lib/project-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export type TSCompilerOptions = Partial<
// Directory preferences
| 'outDir'
| 'rootDir'
// TypeScript path mapping
| 'baseUrl'
| 'paths'
// Style preferences
| 'forceConsistentCasingInFileNames'
// Source map preferences
Expand Down Expand Up @@ -220,6 +223,8 @@ export function loadProjectInfo(projectRoot: string): ProjectInfoResult {
tsc: {
outDir: pkg.jsii?.tsc?.outDir,
rootDir: pkg.jsii?.tsc?.rootDir,
baseUrl: pkg.jsii?.tsc?.baseUrl,
paths: pkg.jsii?.tsc?.paths,
forceConsistentCasingInFileNames:
pkg.jsii?.tsc?.forceConsistentCasingInFileNames,
..._sourceMapPreferences(pkg.jsii?.tsc),
Expand Down