Skip to content

Commit 758ee27

Browse files
committed
Fix: Use TSconfig project level
1 parent 36c3dbc commit 758ee27

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

bin/helpers/readCypressConfigUtil.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,18 @@ function generateTscCommandAndTempTsConfig(bsConfig, bstack_node_modules_path, c
1717
const working_dir = path.dirname(cypress_config_filepath);
1818
const typescript_path = path.join(bstack_node_modules_path, 'typescript', 'bin', 'tsc');
1919
const tsc_alias_path = path.join(bstack_node_modules_path, 'tsc-alias', 'dist', 'bin', 'index.js');
20-
const tsConfigFilePath = bsConfig.run_settings.ts_config_file_path;
20+
const tsConfigFilePath = path.resolve(bsConfig.run_settings.ts_config_file_path);
2121

2222
// Prepare base temp tsconfig
2323
const tempTsConfig = {
24+
extends: tsConfigFilePath, // Use a base tsconfig if available
2425
compilerOptions: {
2526
"outDir": `${path.basename(complied_js_dir)}`, // Add ./ prefix for consistency
2627
"listEmittedFiles": true,
27-
"allowSyntheticDefaultImports": true,
28-
"module": "nodenext",
29-
"declaration": false,
30-
"baseUrl": ".", // Default fallback baseUrl
31-
"skipLibCheck": true
3228
},
3329
include: [cypress_config_filepath]
3430
};
3531

36-
// Inject paths and baseUrl from original tsconfig if available
37-
if (tsConfigFilePath && fs.existsSync(tsConfigFilePath) && path.extname(tsConfigFilePath).toLowerCase() === '.json') {
38-
const tsConfig = JSON.parse(fs.readFileSync(tsConfigFilePath, 'utf8'));
39-
if (tsConfig.compilerOptions) {
40-
if (tsConfig.compilerOptions.paths) {
41-
tempTsConfig.compilerOptions.baseUrl = path.dirname(path.resolve(tsConfigFilePath));
42-
tempTsConfig.compilerOptions.paths = tsConfig.compilerOptions.paths;
43-
}
44-
}
45-
} else {
46-
logger.warn(`tsconfig file not found or invalid: ${tsConfigFilePath}`);
47-
}
48-
4932
// Write the temporary tsconfig
5033
const tempTsConfigPath = path.join(working_dir, 'tsconfig.singlefile.tmp.json');
5134
fs.writeFileSync(tempTsConfigPath, JSON.stringify(tempTsConfig, null, 2));

0 commit comments

Comments
 (0)