Skip to content

Commit 86a3f90

Browse files
filipesilvaalxhub
authored andcommittedApr 16, 2019
fix(compiler-cli): pass config path to ts.parseJsonConfigFileContent (#29872)
The config path is an optional argument to `ts.parseJsonConfigFileContent`. When passed, it is added to the returned object as `options.configFilePath`, and `tsc` itself passes it in. The new TS 3.4 [incremental](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html) build functionality relies on this property being present: https://github.com/Microsoft/TypeScript/blob/025d82633915b67003ea38ba40b9239a19721c13/src/compiler/emitter.ts#L56-L57 When using The compiler-cli `readConfiguration` the config path option isn't passed, preventing consumers (like @ngtools/webpack) from obtaining a complete config object. This PR fixes this omission and should allow JIT users of @ngtools/webpack to set the `incremental` option in their tsconfig and have it be used by the TS program. I tested this in JIT and saw a small decrease in build times in a small project. In AOT the incremental option didn't seem to be used at all, due to how `ngc` uses the TS APIs. Related to https://github.com/angular/angular-cli/issues/13941. PR Close #29872
1 parent 2bfb6a0 commit 86a3f90

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎packages/compiler-cli/src/perform_compile.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,9 @@ export function readConfiguration(
179179
readDirectory: ts.sys.readDirectory,
180180
readFile: ts.sys.readFile
181181
};
182-
const parsed =
183-
ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingOptions);
182+
const configFileName = path.resolve(process.cwd(), projectFile);
183+
const parsed = ts.parseJsonConfigFileContent(
184+
config, parseConfigHost, basePath, existingOptions, configFileName);
184185
const rootNames = parsed.fileNames.map(f => path.normalize(f));
185186

186187
const options = createNgCompilerOptions(basePath, config, parsed.options);

0 commit comments

Comments
 (0)
Please sign in to comment.