-
Notifications
You must be signed in to change notification settings - Fork 209
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
PeerDependencies are not passed through to remote if shell is not using it #731
Comments
Hi @Kawachen97, Yes, Is it possible that If it's an ordinary dependency, the new You can activate it for all deps (using |
Hi @manfredsteyer, I'm sorry, I don't think I expressed my thoughts well. After discussing it with a colleague, I want to try again: The @escid-ux/angular-components is a package for sharing a collection of separate components (classic components lib). In our shell/host frontend and in our remote frontend we use this package. So I thought it might make sense to share it. One of the components inside the @escid-ux/angular-components is dependent on ngx-charts (@escid-ux/angular-components/organisms/charts in particular). ngx-charts is definitely referenced as a peerDependency, so if we want to use it, we need to make sure in the shell/host that ngx-charts is installed. In our shell/host, we don't use this particular component, so we don't have ngx-charts installed. When we now share the @escid-ux/angular-components/organisms/charts component via native federation, the component's javascript file is checked and fails because ngx-charts obviously cannot be found. If we don't share it, everything works as expected. I now understand that this behaviour is quite normal because native federation has to go through the shared packages to make sure everything is available. At first I was under the impression that we didn't need the peerDependency to be available at compile time and that it would be enough to have ngx-charts installed on the remote frontend and fetch it at runtime. Is this true? Now that I think about it, it probably doesn't even make sense to share @escid-ux/angular-components/organisms/charts, because it is only used by the remote, and only share what is really used in both shell/host and remote. |
It should indeed be enough to have this dependency in the remote(s). Can you please provide a minimal reproduction of this issue via a github project? |
With what library do you have an issue?
native-federation
Reproduction of the bug/regression with instructions
Hey,


we are using a package that needs some peerDependencies to work properly. Our shell is not using the components that need the peerDependency. We don't know which of those peerDepenencies will be needed by the remote and therefor also don't know which of them to install. We also want to prevent installing and sharing all of them. On startup, native-federation fails, while resolving the dependencies, which are declared as peer:
As a workaround we are now skipping those subpackages in the federation.config:
Expected behavior
My expectation would be, that those peerDependency constraints are passed through to the remote.
If the remote needs them, it can install them and if not, then not.
Versions of Native/Module Federation, Angular, Node, Browser, and operating system
NativeFederation: 18
Angular: 18
Other information
No response
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: