fix(ngcc): report a warning if ngcc tries to use a solution-style tsconfig (#38003)

In CLI v10 there was a move to use the new solution-style tsconfig
which became available in TS 3.9.

The result of this is that the standard tsconfig.json no longer contains
important information such as "paths" mappings, which ngcc might need to
correctly compute dependencies.

ngcc (and ngc and tsc) infer the path to tsconfig.json if not given an
explicit tsconfig file-path. But now that means it infers the solution
tsconfig rather than one that contains the useful information it used to
get.

This commit logs a warning in this case to inform the developer
that they might not have meant to load this tsconfig and offer
alternative options.

Fixes #36386

PR Close #38003
This commit is contained in:
Pete Bacon Darwin
2020-07-10 16:42:37 +01:00
committed by Andrew Scott
parent f4fac406b9
commit b358495a6c
3 changed files with 73 additions and 1 deletions

View File

@ -112,6 +112,7 @@ export interface ParsedConfiguration {
project: string;
options: api.CompilerOptions;
rootNames: string[];
projectReferences?: readonly ts.ProjectReference[]|undefined;
emitFlags: api.EmitFlags;
errors: Diagnostics;
}
@ -197,6 +198,7 @@ export function readConfiguration(
const parsed = ts.parseJsonConfigFileContent(
config, parseConfigHost, basePath, existingOptions, configFileName);
const rootNames = parsed.fileNames;
const projectReferences = parsed.projectReferences;
const options = createNgCompilerOptions(basePath, config, parsed.options);
let emitFlags = api.EmitFlags.Default;
@ -206,7 +208,14 @@ export function readConfiguration(
if (options.skipTemplateCodegen) {
emitFlags = emitFlags & ~api.EmitFlags.Codegen;
}
return {project: projectFile, rootNames, options, errors: parsed.errors, emitFlags};
return {
project: projectFile,
rootNames,
projectReferences,
options,
errors: parsed.errors,
emitFlags
};
} catch (e) {
const errors: Diagnostics = [{
category: ts.DiagnosticCategory.Error,