Skip to content

Commit b65860f

Browse files
alan-agius4hansl
authored andcommitted
feat(@ngtools/webpack): add support for traceResolution
Closes #8676
1 parent 2f7f00f commit b65860f

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

packages/ngtools/webpack/src/compiler_host.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ export class WebpackCompilerHost implements ts.CompilerHost {
246246
return this.readFile(fileName);
247247
}
248248
}
249+
250+
trace(message: string) {
251+
console.log(message);
252+
}
249253
}
250254

251255

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { ng } from '../../utils/process';
2+
import { updateJsonFile } from '../../utils/project';
3+
4+
export default async function () {
5+
await updateJsonFile('tsconfig.json', tsconfig => {
6+
tsconfig.compilerOptions.traceResolution = true;
7+
});
8+
9+
const { stdout: stdoutTraced } = await ng('build');
10+
if (!/Resolving module/.test(stdoutTraced)) {
11+
throw new Error(`Modules resolutions must be printed when 'traceResolution' is enabled.`);
12+
}
13+
14+
await updateJsonFile('tsconfig.json', tsconfig => {
15+
tsconfig.compilerOptions.traceResolution = false;
16+
});
17+
18+
const { stdout: stdoutUnTraced } = await ng('build');
19+
if (/Resolving module/.test(stdoutUnTraced)) {
20+
throw new Error(`Modules resolutions must not be printed when 'traceResolution' is disabled.`);
21+
}
22+
}

0 commit comments

Comments
 (0)