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: 025d826339/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
This commit is contained in:
Filipe Silva 2019-04-12 16:14:35 +01:00 committed by Alex Rickabaugh
parent 2bfb6a02e2
commit 86a3f90954
1 changed files with 3 additions and 2 deletions

View File

@ -179,8 +179,9 @@ export function readConfiguration(
readDirectory: ts.sys.readDirectory, readDirectory: ts.sys.readDirectory,
readFile: ts.sys.readFile readFile: ts.sys.readFile
}; };
const parsed = const configFileName = path.resolve(process.cwd(), projectFile);
ts.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingOptions); const parsed = ts.parseJsonConfigFileContent(
config, parseConfigHost, basePath, existingOptions, configFileName);
const rootNames = parsed.fileNames.map(f => path.normalize(f)); const rootNames = parsed.fileNames.map(f => path.normalize(f));
const options = createNgCompilerOptions(basePath, config, parsed.options); const options = createNgCompilerOptions(basePath, config, parsed.options);