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

Empty packages as valid v2 addons #2012

Merged
merged 1 commit into from
Jul 3, 2024
Merged

Empty packages as valid v2 addons #2012

merged 1 commit into from
Jul 3, 2024

Conversation

BlueCutOfficial
Copy link
Collaborator

The issue was initially raised by #1931.

Problem

In tests relying on ember-data 4.4, the rewritten-packages contain multiple copies of @ember-data/store. Only one copy has content, the others are empty. The only copy having content is the only "active" package.

During the build process, we expect requests for the empty packages to resolve to the corresponding "active" package; but instead, they resolved to the empty copy, which triggered a build error.

Cause

This was because when the core module-resolver handles an empty package, it returns before the rehoming to the active package can happen. The condition that triggered the return was: if (!pck.isV2Addon()) return /* ... */: in other words, empty packages generated by the EmptyPackageTree plugin are not valid v2 addons, causing the module-resolver to give an unexpected answer.

Solution

This PR changes the EmptyPackageTree plugin to add more information in the package.json of the empty package: it now has the keys that identify a package as a valid v2 package.

Once the module-resolver recognizes an empty package as a valid v2 package, it continues the execution until it rehomes the request and resolve to the active package.

Copy link
Member

@mansona mansona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@mansona mansona added the bug Something isn't working label Jul 3, 2024
@mansona mansona merged commit 6c91dca into stable Jul 3, 2024
203 checks passed
@mansona mansona deleted the fix-empty-packages branch July 3, 2024 12:35
@github-actions github-actions bot mentioned this pull request Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants