Skip to content

Module federation cannot resolve version of secondary entry points with no version #15864

@yharaskrik

Description

@yharaskrik

Bug 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:
nrwl/nx#10460

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions