Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ngcc): correctly resolve UMD dependencies #44382

Closed

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented Dec 5, 2021

This is a backport of #44381 to the 12.2.x branch.

Previously, when processing UMD, ngcc assumed that the exports argument of the CommonJS factory call (if present) would be the first argument of the call. This is generally true for the supported UMD formats, but can change if ngcc prepends more imports (and thus factory arguments) while processing the module. This could lead to errors when trying to collect dependencies of an already processed module.
(This was accidentally broken in #44245 (commit 2bc3522).)

This commit fixes it by not making any assumptions about the position of an exports argument in the CommonJS factory call.

Fixes #44380.

Previously, when processing UMD, ngcc assumed that the `exports`
argument of the CommonJS factory call (if present) would be the first
argument of the call. This is generally true for the supported UMD
formats, but can change if ngcc prepends more imports (and thus factory
arguments) while processing the module. This could lead to errors when
trying to collect dependencies of an already processed module.
(This was accidentally broken in angular#44245 (commit 2bc3522).)

This commit fixes it by not making any assumptions about the position of
an `exports` argument in the CommonJS factory call.

Fixes angular#44380
@gkalpak gkalpak added type: bug/fix target: lts This PR is targeting a version currently in long-term support comp: ngcc labels Dec 5, 2021
@ngbot ngbot bot modified the milestone: Backlog Dec 5, 2021
@google-cla google-cla bot added the cla: yes label Dec 5, 2021
@mary-poppins
Copy link

You can preview 40459d9 at https://pr44382-40459d9.ngbuilds.io/.

@gkalpak gkalpak marked this pull request as ready for review December 6, 2021 17:33
@mary-poppins
Copy link

You can preview c502061 at https://pr44382-c502061.ngbuilds.io/.

@gkalpak gkalpak added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Dec 6, 2021
@gkalpak
Copy link
Member Author

gkalpak commented Dec 6, 2021

merge-assistance: The changes have been approved on the original PR (#44381).

@alxhub
Copy link
Member

alxhub commented Dec 7, 2021

This PR was merged into the repository by commit b6554d7.

@alxhub alxhub closed this Dec 7, 2021
alxhub pushed a commit that referenced this pull request Dec 7, 2021
Previously, when processing UMD, ngcc assumed that the `exports`
argument of the CommonJS factory call (if present) would be the first
argument of the call. This is generally true for the supported UMD
formats, but can change if ngcc prepends more imports (and thus factory
arguments) while processing the module. This could lead to errors when
trying to collect dependencies of an already processed module.
(This was accidentally broken in #44245 (commit 2bc3522).)

This commit fixes it by not making any assumptions about the position of
an `exports` argument in the CommonJS factory call.

Fixes #44380

PR Close #44382
@gkalpak gkalpak deleted the 12.2.x-fix-ngcc-umd-preceeding-imports branch December 7, 2021 15:58
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jan 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note PullApprove: disable target: lts This PR is targeting a version currently in long-term support type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants