Skip to content

Error message still is wrong #28904

Closed
Closed

Description

@Gouvernathor

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

Activity

  1. aparzi commented on Jan 25, 2025

    @aparzi
    Contributor

    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

  2. Gouvernathor commented on Oct 3, 2025

    @Gouvernathor
    Author

    Reporting that the error message is still wrong a year later @alan-agius4

  3. alan-agius4 commented on Oct 4, 2025

    @alan-agius4
    Collaborator

    @Gouvernathor, feel free to open a PR.

  4. Gouvernathor commented on Oct 4, 2025

    @Gouvernathor
    Author

    That's what @aparzi was asking for

  5. aparzi commented on Oct 4, 2025

    @aparzi
    Contributor

    @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.

  6. added a commit that references this issue on Mar 27, 2026
    8c9238e
  7. maruthang commented on Mar 27, 2026

    @maruthang
    Contributor

    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.

  8. added a commit that references this issue on Jul 6, 2026
    54fc33f
  9. added a commit that references this issue on Aug 18, 2026
    b83d919
  10. added 2 commits that reference this issue on Aug 18, 2026
    1ee0bec
    cba7290
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions