Skip to content

Commit

Permalink
fix: relative path baseUrl resolves wrong path
Browse files Browse the repository at this point in the history
  • Loading branch information
plantain-00 committed Mar 13, 2022
1 parent 0b7d23a commit 7e668d9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/core/src/tsconfig.ts
Expand Up @@ -17,6 +17,18 @@ export async function getProjectRootNamesAndCompilerOptions(project: string) {
}

const rootNames = await getRootNames(config, dirname)
if (compilerOptions.baseUrl) {
if (compilerOptions.baseUrl === '.'
|| compilerOptions.baseUrl === '..'
|| compilerOptions.baseUrl.startsWith(`.${path.sep}`)
|| compilerOptions.baseUrl.startsWith(`..${path.sep}`)
|| compilerOptions.baseUrl.startsWith('./')
|| compilerOptions.baseUrl.startsWith('../')
) {
compilerOptions.baseUrl = path.resolve(path.resolve(process.cwd(), dirname), compilerOptions.baseUrl)
}
}

return { rootNames, compilerOptions }
}

Expand Down

0 comments on commit 7e668d9

Please sign in to comment.