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.

Duplicate atom key when using Webpack Module Federation

See original GitHub issue

We’re currently investigating how we could fully use the advantages Webpack’s Module Federation can offer.

However, when exposing an atom from one module to another, we get the Duplicate atom key warning.

Is this something that we should be worried about? Is there something we can do?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:5
  • Comments:10

github_iconTop GitHub Comments

1reaction
andreawysscommented, Mar 27, 2022

I was able to resolve the issue by having a single common federated bundle containing the app providers with the RecoilRoot and the atoms that need to be shared across federated bundles. All other federated bundles have this common federated bundle as a Remote dependency.

0reactions
liuyisnakecommented, Jun 15, 2022

met the same issue and i use snapshot_UNSTABLE() to avoid redefine

const snap = snapshot_UNSTABLE(); const current = Array.from(snap.getNodes_UNSTABLE()); function singletonAtom<T> (options: AtomOptions<T>) { const previous:RecoilState<T> = current.find((item) => item.key === options.key) as RecoilState<T>; return previous ?? atom(options); }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Recoil Duplicate atom key when using with Webpack Module ...
It's working fine but I got this warning in the console: Duplicate atom key "userAuthState". This is a FATAL ERROR in production. But...
Read more >
Recoil Duplicate Atom Key When Using With Webpack Module ...
i made a function that will take the date and then change it to a string however typescript says that it is possibly...
Read more >
[Recoil ver 0.0.10] "Duplicate atom key" message ... - Filtrate
When using Recoil ver 0.0.10 on HMR (Hot Module Replacement) environment, you can see "Duplicate atom key" message on your console.
Read more >
Recoil for Micro-FE State Management - Blue Collar Coder
Micro-Frontends and Module Federation creates an interesting challenge ... import { atom } from "recoil"; export const name = atom({ key: ...
Read more >
Micro-frontends: Module Federation with WebPack 5
With Module Federation you can import remote Webpack builds to your application. Currently, you could import these chunks but they would ...
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