Skip to content

ngcc: processing of recently published UMD bundles may fail #44037

Closed

Description

@JoostK

Problem description

Recently, a number of issues (#43870, #43936, #44019) has started to occur for certain UMD bundles when ngcc (the Angular Compatibility Compiler) processes them to create an Ivy-compatible version of the UMD bundle.

Recent changes to how UMD bundles are formatted are not supported by the current Angular Compatibility Compiler (ngcc), which can result in a fatal error, like the following:

  • TypeError: Cannot read property 'text' of undefined
  • Error: Failed to find exported name of node

Packages from the @angular scope are not affected, but recent versions of third-party libraries may result in one of the above fatal errors.

In the typical Angular CLI setup UMD bundles are not generally needed, as ES2015 bundles are preferred over UMD. It is therefore expected that CLI users won't be affected by these issues.

Available workarounds

If ngcc is manually executed from outside of the CLI, without the --properties argument, then it will process all available formats in a library including the UMD bundles. In that case, ngcc may fail if a library is used that contains the newly structured code that ngcc is currently unable to understand. It may be that the UMD bundles are not actually necessary, in which case ngcc can be configured not to process the UMD bundles at all. To this effect, pass the --properties es2015 module argument to ngcc.

If you do require the UMD bundles to be processed, for example if you're using Jest for unit testing, then the only workaround that is currently available is to pin the dependency that breaks ngcc to an earlier version which does not contain the problematic code patterns that cause ngcc to fail.

Next steps

Although some of the changes have already been accounted for in the latest Angular 12 releases, we're still working on a solution to resolve all ngcc failures of UMD bundles.

Activity

  1. added this to the needsTriage milestone on Nov 3, 2021
  2. self-assigned this
    on Nov 4, 2021
  3. added a commit that references this issue on Jan 15, 2022
    f9ca4d8
  4. added a commit that references this issue on Jan 25, 2022
    460befd
  5. angular-automatic-lock-bot commented on Feb 15, 2022

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  6. locked and limited conversation to collaborators on Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions