Skip to content

Commit b0c1551

Browse files
clydinhansl
authored andcommitted
fix(@ngtools/webpack): only diagnose each resource once (#4374)
1 parent 6650b75 commit b0c1551

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎packages/@ngtools/webpack/src/loader.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,12 +307,14 @@ function _checkDiagnostics(refactor: TypeScriptFileRefactor) {
307307
* Recursively calls diagnose on the plugins for all the reverse dependencies.
308308
* @private
309309
*/
310-
function _diagnoseDeps(reasons: ModuleReason[], plugin: AotPlugin) {
310+
function _diagnoseDeps(reasons: ModuleReason[], plugin: AotPlugin, checked: Set<string>) {
311311
reasons
312312
.filter(reason => reason && reason.module && reason.module instanceof NormalModule)
313+
.filter(reason => !checked.has(reason.module.resource))
313314
.forEach(reason => {
315+
checked.add(reason.module.resource);
314316
plugin.diagnose(reason.module.resource);
315-
_diagnoseDeps(reason.module.reasons, plugin);
317+
_diagnoseDeps(reason.module.reasons, plugin, checked);
316318
});
317319
}
318320

@@ -344,7 +346,7 @@ export function ngcLoader(this: LoaderContext & { _compilation: any }) {
344346
if (plugin.typeCheck) {
345347
// Check all diagnostics from this and reverse dependencies also.
346348
if (!plugin.firstRun) {
347-
_diagnoseDeps(this._module.reasons, plugin);
349+
_diagnoseDeps(this._module.reasons, plugin, new Set<string>());
348350
}
349351
// We do this here because it will throw on error, resulting in rebuilding this file
350352
// the next time around if it changes.

0 commit comments

Comments
 (0)