swr: [Module Federation] Failing to determine SWR version

Bug report

Description / Observed Behavior

Failing to determine what SWR version to use with Module Federation based on Webpack & SWR 2.0.

Expected Behavior

No warning nor error should be displayed / thrown when using SWR with Module Federation.

Additional Context

Everything was working great with SWR 1.3.0.

Here is the prompted warning:

WARNING in shared module swr -> .../node_modules/swr/core/dist/index.mjs

No version specified and unable to automatically determine one. No version in description file (usually package.json).
Add version to description file .../node_modules/swr/core/package.json, or manually specify version in shared config.

(Note that the version is already specified in the shared config)

And this is the error thrown:

Uncaught (in promise) Error: Unsatisfied version 0 from micro-frontends of shared singleton module swr (required =2.0.0)

After manually adding a version to the node_modules/swr/core/package.json file, it seems that everything is working as expected but this is not a viable fix.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15

Most upvoted comments

@koba04 Tried to test on my project with Module Federation on the new v2.2.5 everything works great and without any hacks in . Thank you very much for the notification.

We updated our bundle convention at https://github.com/vercel/swr/pull/2865. Unfortunately, this hasn’t been released yet, but the change might solve this problem. I haven’t tested this, I might be wrong.

+1 i tried this : After manually adding a version to the node_modules/swr/core/package.json file, it seems that everything is working as expected but this is not a viable fix. However, I’m still getting the warnings.