diff --git a/packages/angular/build/src/utils/load-proxy-config.ts b/packages/angular/build/src/utils/load-proxy-config.ts index b0882187d0c2..e9e382a7805a 100644 --- a/packages/angular/build/src/utils/load-proxy-config.ts +++ b/packages/angular/build/src/utils/load-proxy-config.ts @@ -67,7 +67,7 @@ export async function loadProxyConfiguration( break; } catch (e) { assertIsError(e); - if (e.code === 'ERR_REQUIRE_ESM') { + if (e.code === 'ERR_REQUIRE_ESM' || e.code === 'ERR_REQUIRE_ASYNC_MODULE') { // Load the ESM configuration file using the TypeScript dynamic import workaround. // Once TypeScript provides support for keeping the dynamic import this workaround can be // changed to a direct dynamic import. diff --git a/packages/angular_devkit/architect/node/node-modules-architect-host.ts b/packages/angular_devkit/architect/node/node-modules-architect-host.ts index e01394a22d04..e30badffcc97 100644 --- a/packages/angular_devkit/architect/node/node-modules-architect-host.ts +++ b/packages/angular_devkit/architect/node/node-modules-architect-host.ts @@ -324,7 +324,10 @@ async function getBuilder(builderPath: string): Promise { try { return localRequire(builderPath); } catch (e) { - if ((e as NodeJS.ErrnoException).code === 'ERR_REQUIRE_ESM') { + if ( + (e as NodeJS.ErrnoException).code === 'ERR_REQUIRE_ESM' || + (e as NodeJS.ErrnoException).code === 'ERR_REQUIRE_ASYNC_MODULE' + ) { // Load the ESM configuration file using the TypeScript dynamic import workaround. // Once TypeScript provides support for keeping the dynamic import this workaround can be // changed to a direct dynamic import. diff --git a/packages/angular_devkit/build_angular/src/tools/webpack/configs/dev-server.ts b/packages/angular_devkit/build_angular/src/tools/webpack/configs/dev-server.ts index bb23a1860510..70d863cdfbfd 100644 --- a/packages/angular_devkit/build_angular/src/tools/webpack/configs/dev-server.ts +++ b/packages/angular_devkit/build_angular/src/tools/webpack/configs/dev-server.ts @@ -210,7 +210,7 @@ async function addProxyConfig( proxyConfiguration = require(proxyPath); } catch (e) { assertIsError(e); - if (e.code !== 'ERR_REQUIRE_ESM') { + if (e.code !== 'ERR_REQUIRE_ESM' && e.code !== 'ERR_REQUIRE_ASYNC_MODULE') { throw e; } diff --git a/packages/angular_devkit/build_webpack/src/utils.ts b/packages/angular_devkit/build_webpack/src/utils.ts index 7a0f228ec676..0254848053f0 100644 --- a/packages/angular_devkit/build_webpack/src/utils.ts +++ b/packages/angular_devkit/build_webpack/src/utils.ts @@ -90,7 +90,10 @@ export async function getWebpackConfig(configPath: string): Promise