Federate module WITHIN NX repo for use in an EXTERNAL repo [Solved] #27720
Replies: 3 comments
-
I fixed this by specifying the library field here....
|
Beta Was this translation helpful? Give feedback.
-
The export error is down to the host application. It doesn’t really matter if the remote or host is in an Nx workspace or not, so long as it’s accessible. If you have a remote that used by a host outside the Nx workspace, then as you’ve done already, you either need to configure the remote to be built to the same ESM/CJS artifact that the host is expecting. within Nx workspaces we tend to stick to ESM, allowing modules and exports to be used. therefore your change makes sense. Just note that if you decide to consume that remote in a host inside the Nx workspace, you may need to either have a separate Webpack config that is used within Nx, or update your host within Nx to also use var |
Beta Was this translation helpful? Give feedback.
-
Hi, I see there's some docs here about creating a remote federated module WITHIN a NX project for use in a host WITHIN a NX project.
https://nx.dev/concepts/module-federation/module-federation-and-nx
Is there any support for federating a module WITHIN a NX repo for use in an EXTERNAL repo that does not use NX?
I tried using a federated module from a NX monorepo in an external repo that isn't using NX & am running into issues
Remote NX version: 19.6.4
Host Webpack version: 5.94.0
I've also gotten this error:
Beta Was this translation helpful? Give feedback.
All reactions