Skip to content

Commit

Permalink
fix(@angular-devkit/build-angular): skip checking CommonJS module des…
Browse files Browse the repository at this point in the history
…cendants

When CommonJS module checking is enabled in the esbuild-based builders (`application`/`browser-esbuild`),
the checker will now skip all descendants of a CommonJS module. Previously it would only skip them if
the module was not allowed. This change now provides the same module checking behavior as the Webpack-based
check. This makes the build behavior more consistent when migrating to the new build system.

(cherry picked from commit 44ea76a)
  • Loading branch information
clydin authored and alan-agius4 committed Oct 30, 2023
1 parent 4b9a87c commit f7f6e97
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -100,11 +100,12 @@ export function checkCommonJSModules(
}

if (notAllowed) {
// Issue a diagnostic message and skip all descendants since they are also most
// likely not ESM but solved by addressing this import.
// Issue a diagnostic message for CommonJS module
messages.push(createCommonJSModuleError(request, currentFile));
continue;
}

// Skip all descendants since they are also most likely not ESM but solved by addressing this import
continue;
}

// Add the path so that its imports can be checked
Expand Down

0 comments on commit f7f6e97

Please sign in to comment.