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

Generate per-package implicit-modules imports #1536

Merged
merged 5 commits into from
Jul 16, 2023
Merged

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented Jul 15, 2023

Previously, all implicit-modules got imported by their containing engine (normally the app). This makes some sense, because they are getting AMD-defined into one flat namespace anyway for compatibility reasons. If there are multiple versions of a package in the transitive deps, only one can be present in the AMD loader.

However, this assumes there will be resolvability from the app all the way to the transitive deps, which is not true in general. And it also means that if there is a mismatch between the list of implicit-modules provided by different copies of a package you could run into failures where you try to find them in the wrong copy.

So instead, this PR moves the importing of implicit modules into per-package virtual modules. Each package imports its own direct dependencies' implicit modules, as well as the virtual implicit-module entrypoints for those dependencies.

If you have vast webs of addons, this change might make your code bigger. But the solution to that is enabling staticAddonTrees, which cuts the set of implicit-modules down to approximately zero.

Previously, all implicit-modules got imported by their containing engine (normally the app). This makes some sense, because they are getting AMD-defined into one flat namespace anyway for compatibility reasons. If there are multiple versions of a package in the transitive deps, only one can be present in the AMD loader.

However, this assumes there will be resolvability from the app all the way to the transitive deps, which is not reliably true. And it also means that if there is a mismatch between the list of implicit-modules provided by different copies of a package you could run into failures where you try to find them in the wrong copy.

So instead, this PR moves the importing of implicit modules into per-package virtual modules. Each package imports its own direct dependencies' implicit modules, as well as the virtual implicit-module entrypoints for those dependencies, so the system recurses.
@ef4 ef4 added the bug Something isn't working label Jul 15, 2023
@ef4 ef4 merged commit f032c58 into main Jul 16, 2023
196 checks passed
@ef4 ef4 deleted the per-package-implicit-modules branch July 16, 2023 00:31
@ef4 ef4 mentioned this pull request Jul 16, 2023
ef4 added a commit that referenced this pull request Jul 25, 2023
Fixes #1514

The bug was introduced in #1536 when we refactored how implicit-modules get included.

A v2 addon with a v1 addon dependency would miss including implicit-modules for that v1 addon.

This code needed to explicitly ask for the moved copy of a dependency, in case the dependency had moved.
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.

1 participant