Module federation cannot resolve version of secondary entry points with no version
See original GitHub issueBug report
What is the current behavior?
When trying to use packages that have secondary entry points but those entry points package.jsons do not have a version in them, webpack throws warnings like:
shared module @apollo/client/core -> /Users/jaybell/WebstormProjects/trellis-mono4/node_modules/@apollo/client/core/index.js - Warning: No version specified and unable to automatically determine one. No version in description file (usually package.json). Add version to description file, or manually specify version in shared config.
@apollo/client/core has a package.json with a version, @apollo/client/core has a package.json but does not have a version. What is the workaround for this? If a package does not have a version in it’s published version but the root package does how should I configure webpack so that it can resolve the root version?
I tried adding additional shared mappings but that doesn’t seem to work
If the current behavior is a bug, please provide the steps to reproduce.
Simplest way:
Generate an Nx with angular preset
generate a host and remote app
use @apollo/client (or any other package with a secondary entry point that is lacking a version)
Run the serve target for the host and see the error.
What is the expected behavior?
Should be able to use packages even if their secondary entry points do not have a version possibly should inherit the version from the root of the package, unless there is a reason or explanation as to why it is working the way it is.
Other relevant information: webpack version: 5.69.0 Node.js version: 14.19.0 Operating System: MacOS 10.15.17 Additional tools:
Reported it here too: https://github.com/nrwl/nx/issues/10460
Issue Analytics
- State:
- Created a year ago
- Comments:7 (3 by maintainers)

Top Related StackOverflow Question
What about the “…or manually specify version in shared config.” part? Adding
@apollo/client/core: { requiredVersion: 'whatever' }toshareddoesn’t work. Am I missing something?@nkalinov you can add version of packeges, that work for me, like this:
"mapbox-gl": { requiredVersion: "^2.11.0", version: "^2.11.0", singleton: true, }