question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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: https://github.com/nrwl/nx/issues/10460

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nkalinovcommented, Sep 9, 2022

What about the “…or manually specify version in shared config.” part? Adding @apollo/client/core: { requiredVersion: 'whatever' } to shared doesn’t work. Am I missing something?

0reactions
saeedghasemi72commented, Dec 12, 2022

@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, }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module Federation Series Part 1: A Little in-depth
Module federation is smart to auto define versions but in some cases, it can't find versions of secondary entry points. For more details...
Read more >
Pitfalls with Module Federation and Angular
"No required version specified" and Secondary Entry Points. For the first pitfall I want to talk about, let's have a look to our...
Read more >
Module Federation Shared Services - angular - Stack Overflow
I can't figure out how to share a singleton service from a shared local Angular library between my two apps. I'll do my...
Read more >
@angular-architects/module-federation - npm
Seamlessly using Webpack Module Federation with the Angular CLI.. Latest version: 15.0.2, last published: a month ago.
Read more >
Micro Frontends with Angular, Module Federation, and Auth0
Module Federation allows loading Micro Frontends at runtime. ... our integration tests to immediately find out about version mismatches.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found