Repository navigation
Error message still is wrong #28904
Copy link
Copy link
Labels
area: @angular/buildfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity1: confusingtype: bug/fix
Description
Command
serve
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
As stated in the other issues, the error message indicates that there is an incompatibility with browser version constraints, mentioning a "target environment" and listing browser versions. But the actual reason (a bug in zone.js) has nothing to do with browser constraints.
In case your goal is not to make devs lose many days trying to remove browser constraints that aren't there, this should be fixed.
Minimal Reproduction
import languageIds from '../assets/langages.json';
export {languageIds};
const translations: Readonly<Record<string, Readonly<Record<string, string>>>> = Object.fromEntries(await Promise.all(
languageIds.map(async (languageId) => (
[languageId, await import(`../assets/languages/${languageId}.json`)]
))));With the required JSON files, followed by ng serve or ng build.
Exception or Error
X [ERROR] Top-level await is not available in the configured target environment ("chrome129.0", "edge129.0", "firefox115.0", "ios17.0", "node22.0.0", "safari17.0" + 5 overrides)
src/configuration.ts:5:40:
5 │ ...slations = Object.fromEntries(await Promise.all(languageIds.map(...
╵ ~~~~~
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 18.2.12
Node: 20.18.0
Package Manager: npm 10.9.0
OS: win32 x64
Angular: 18.2.12
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1802.12
@angular-devkit/build-angular 18.2.12
@angular-devkit/core 18.2.12
@angular-devkit/schematics 18.2.12
@schematics/angular 18.2.12
rxjs 7.8.1
typescript 5.5.4
zone.js 0.14.10
Anything else relevant?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: @angular/buildfreq1: lowOnly reported by a handful of users who observe it rarelyOnly reported by a handful of users who observe it rarelyseverity1: confusingtype: bug/fix
Activity
aparzi commentedon Jan 25, 2025
Hi @alan-agius4,
I would like to deal with this issue is it possible? If there are already some indications on the possible resolution I could proceed by following them.
Thank you very much
Gouvernathor commentedon Oct 3, 2025
Reporting that the error message is still wrong a year later @alan-agius4
alan-agius4 commentedon Oct 4, 2025
@Gouvernathor, feel free to open a PR.
Gouvernathor commentedon Oct 4, 2025
That's what @aparzi was asking for
aparzi commentedon Oct 4, 2025
@Gouvernathor I'm currently working on some Angular Core migration issues, but I don't know if I'll be able to dedicate any time to this problem. If I can, I'll gladly do so.
fix(@angular/build): correct misleading error message for top-level a…
maruthang commentedon Mar 27, 2026
Hi, I'd like to work on this issue.
Root cause: When Zone.js is in use, Angular explicitly disables native async/await in esbuild (because Zone.js cannot intercept it). When a user uses top-level
await, esbuild reports "Top-level await is not available in the configured target environment" with browser versions — which is misleading since all modern browsers support it. The real issue is Zone.js incompatibility.Proposed fix: Detect top-level await errors in the bundling results when Zone.js is active, and augment the error with explanatory notes: "Top-level await is not supported in applications that use Zone.js" with a link to the zoneless docs.
Submitting a PR now.
fix(@angular/build): correct misleading error message for top-level a…
fix(@angular/build): correct misleading error message for top-level a…
fix(@angular/build): correct misleading error message for top-level a…
fix(@angular/build): correct misleading error message for top-level a…