diff --git a/packages/ngtools/webpack/src/compiler_host.ts b/packages/ngtools/webpack/src/compiler_host.ts index a5c2572dfdce..2c0ea9b65c93 100644 --- a/packages/ngtools/webpack/src/compiler_host.ts +++ b/packages/ngtools/webpack/src/compiler_host.ts @@ -246,6 +246,10 @@ export class WebpackCompilerHost implements ts.CompilerHost { return this.readFile(fileName); } } + + trace(message: string) { + console.log(message); + } } diff --git a/tests/legacy-cli/e2e/tests/misc/trace-resolution.ts b/tests/legacy-cli/e2e/tests/misc/trace-resolution.ts new file mode 100644 index 000000000000..30c8113ce9ec --- /dev/null +++ b/tests/legacy-cli/e2e/tests/misc/trace-resolution.ts @@ -0,0 +1,22 @@ +import { ng } from '../../utils/process'; +import { updateJsonFile } from '../../utils/project'; + +export default async function () { + await updateJsonFile('tsconfig.json', tsconfig => { + tsconfig.compilerOptions.traceResolution = true; + }); + + const { stdout: stdoutTraced } = await ng('build'); + if (!/Resolving module/.test(stdoutTraced)) { + throw new Error(`Modules resolutions must be printed when 'traceResolution' is enabled.`); + } + + await updateJsonFile('tsconfig.json', tsconfig => { + tsconfig.compilerOptions.traceResolution = false; + }); + + const { stdout: stdoutUnTraced } = await ng('build'); + if (/Resolving module/.test(stdoutUnTraced)) { + throw new Error(`Modules resolutions must not be printed when 'traceResolution' is disabled.`); + } +}