Skip to content

Commit

Permalink
Fix build with TS alias without basePath
Browse files Browse the repository at this point in the history
  • Loading branch information
callingmedic911 committed Oct 10, 2024
1 parent cd4c8bc commit d619c51
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/babel-config/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,21 @@ export const getPathsFromTypeScriptConfig = (
return {}
}

if (!config.compilerOptions?.baseUrl || !config.compilerOptions?.paths) {
if (!config.compilerOptions?.paths) {
return {}
}

const { baseUrl, paths } = config.compilerOptions

// Convert it to absolute path - on windows the baseUrl is already absolute
const absoluteBase = path.isAbsolute(baseUrl)
? baseUrl
: path.join(rootDir, baseUrl)
let absoluteBase: string
if (baseUrl) {
// Convert it to absolute path - on windows the baseUrl is already absolute
absoluteBase = path.isAbsolute(baseUrl)
? baseUrl
: path.join(rootDir, baseUrl)
} else {
absoluteBase = rootDir
}

const pathsObj: Record<string, string> = {}
for (const [key, value] of Object.entries(paths)) {
Expand Down

0 comments on commit d619c51

Please sign in to comment.