Skip to content

Commit

Permalink
fix: add default tsconfig.baseUrl to align with tsc behavior (#759)
Browse files Browse the repository at this point in the history
  • Loading branch information
yeliex committed Mar 5, 2024
1 parent d35ddf1 commit 96139f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-rockets-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fake-scope/fake-pkg": patch
---

fix: add default tsconfig.baseUrl to align with tsc behavior
6 changes: 6 additions & 0 deletions packages/register/read-default-tsconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export function readDefaultTsConfig(
const { config } = ts.readConfigFile(fullTsConfigPath, ts.sys.readFile)

const { options, errors, fileNames } = ts.parseJsonConfigFileContent(config, ts.sys, dirname(fullTsConfigPath))

// if baseUrl not set, use dirname of tsconfig.json. align with ts https://www.typescriptlang.org/tsconfig#paths
if (options.paths && !options.baseUrl) {
options.baseUrl = dirname(fullTsConfigPath)
}

if (!errors.length) {
compilerOptions = options
compilerOptions.files = fileNames
Expand Down

0 comments on commit 96139f7

Please sign in to comment.