-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add exports field to package.json #212
Comments
Are there any considerations we need to make for our React wrapper components? |
Well an entry point can only be a single file/location. If we want the same experience with sharing the React versions we'd need to define a separate package (something like |
Learned today that modules shared via ModuleFederation are unable to be tree shaken. So it's worth noting that if we go this route the entirety of the |
We need to wait until TypeScript supports finding type definitions for modified export subpaths with using the |
seems like this should be possible now |
Resolved by #472 |
The problem
Webpack 5 module federation dependency sharing works best with imports from a package's root entry file. Currently to share Pharos, folks would need to list the individual components they'd like to share as their imports go deep into the package:
The solution
Address #3 and then add an exports field to the package.json to define the main entry point and encapsulate the package to prevent other entry points.
The first entry would allow consumers to import component definitions in this way:
Thus they would only need to add
@ithaka/pharos
as a shared dependency in their MFE configuration.Alternatives considered
N/A.
Additional information
This will likely be a breaking change as only the entry points defined in the field would be allowed.
The text was updated successfully, but these errors were encountered: