#142·umd

Using UMD to create Singleton Instance across Micro Frontends

Author: NikJ87Created Aug 9, 2022Updated Feb 15, 2024

Hi,

I have a use case where I want to shared Singleton instance across Microfrontend with following condition:

  1. First Micro frontend created in Vanilla JS
  2. Other Micro frontend created in React JS
  3. which ever load first initializes the instance of my JS script and other while loading just uses it.

I was looking forward to use UMD but couldn't work it out without attaching initialised instance to window object. But I don't want to expose it at global variable level.