Skip to content

Commit 61e4df4

Browse files
committed
feat(scripts): update ts just task compilation to work with v8 path aliases setup
1 parent c213d37 commit 61e4df4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/tasks/ts.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,22 @@ function prepareTsTaskConfig(options: TscTaskOptions) {
2222
options.sourceMap = true;
2323
}
2424

25+
const tsConfigProjectRoot = 'tsconfig.json';
2526
const tsConfigLib = 'tsconfig.lib.json';
2627
const isUsingTsSolutionConfigs = fs.existsSync(resolveCwd(tsConfigLib));
2728

28-
if (isUsingTsSolutionConfigs) {
29+
const tsConfig = JSON.parse(fs.readFileSync(resolveCwd(tsConfigProjectRoot), 'utf-8'));
30+
const isUsingV8pathAliases = tsConfig.extends && tsConfig.extends.includes('tsconfig.base.v8.json');
31+
32+
if (isUsingTsSolutionConfigs || isUsingV8pathAliases) {
2933
// For converged packages (which use TS path aliases), explicitly set `baseUrl` and `rootDir` to current package root.
3034
// > - This is a temporary workaround for current way of building packages via lage and just scripts.
3135
// > - Without setting baseUrl we would get all aliased packages build within outDir
3236
// > - Without setting rootDir we would get output dir mapping following path from monorepo root
3337
logger.info(`📣 TSC: package is using TS path aliases. Overriding tsconfig settings.`);
3438
options.baseUrl = '.';
3539
options.rootDir = './src';
36-
options.project = tsConfigLib;
40+
options.project = isUsingTsSolutionConfigs ? tsConfigLib : tsConfigProjectRoot;
3741
}
3842

3943
return options;

0 commit comments

Comments
 (0)