fix(builders): externalize synthesized imports in exposed and mapping bundles - #146
Merged
Merged
Conversation
… bundles The shared-mappings plugin was only wired into the app build. An exposed module that reaches a mapped lib through an NgModule still got Angular's synthesized deep import inlined, shipping a second instance of the lib and its InjectionTokens (NG0201). Since core 4.7 exposes and mappings build in separate contexts, so the copy is inlined outright. With one context (core 4.6) it collapses onto the remote's own chunk, but the host's copy of the mapping wins the import map at runtime, so it is still a second instance. Closes #145
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The shared-mappings plugin from #128 was only wired into the app build. An exposed module that reaches a mapped lib through an NgModule still got Angular's synthesized deep import inlined, shipping a second instance of the lib and its
InjectionTokens (NG0201).This adds
createSharedMappingsPlugin(mappedPaths)to the exposed/mapping build, as suggested in the issue.Verification
In
angular-examples/angular/tractor-store, a probeNgModule(a component that injects anInjectionToken) was added to@ng-internal/uiand used viaimports: [ProbeModule]in explore's exposedHomePage:mfe-home-*.jsand_ng_internal_ui-*.js.mfe-homeimports@ng-internal/uifor both references, and the mapping bundle's hash is unchanged.Closes #145