Closed
Description
Command
build
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
Node 20 has added support for require()
to load ESM files, though only ESM files that don't use top-level await.
This breaks the angular CLI loading those modules, since it now fails with with ERR_REQUIRE_ASYNC_MODULE
rather than ERR_REQUIRE_ESM
Minimal Reproduction
Have a builder that uses top-level await, try to use the builder
Exception or Error
Error: unexpected top-level await at file:///home/jenkins/workspace/<redacted>
esbuild = await import("esbuild");
^
An unhandled exception occurred: require() cannot be used on an ESM graph with top-level await. Use import() instead. To see where the top-level await comes from, use --experimental-print-required-tla.
See "/tmp/ng-me8w9s/angular-errors.log" for further details.
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 19.1.7
Node: 20.19.0
Package Manager: yarn 4.0.1
OS: darwin arm64
Angular: undefined
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1901.7
@angular-devkit/core 19.1.7
@angular-devkit/schematics 19.1.7
@angular/cli 19.1.7
@schematics/angular 19.1.7
typescript 5.2.2
Anything else relevant?
No response