Skip to content

Commit f7f6e97

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular-devkit/build-angular): skip checking CommonJS module descendants
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)
1 parent 4b9a87c commit f7f6e97

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/angular_devkit/build_angular/src/tools/esbuild/commonjs-checker.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,12 @@ export function checkCommonJSModules(
100100
}
101101

102102
if (notAllowed) {
103-
// Issue a diagnostic message and skip all descendants since they are also most
104-
// likely not ESM but solved by addressing this import.
103+
// Issue a diagnostic message for CommonJS module
105104
messages.push(createCommonJSModuleError(request, currentFile));
106-
continue;
107105
}
106+
107+
// Skip all descendants since they are also most likely not ESM but solved by addressing this import
108+
continue;
108109
}
109110

110111
// Add the path so that its imports can be checked

0 commit comments

Comments
 (0)