Duplicate atom key when using Webpack Module Federation
See original GitHub issueWe’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:
- Created 2 years ago
- Reactions:5
- Comments:10
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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); }