Hi all — I’m trying to deploy a simple ESM frontend module to OpenMRS O3 but it fails to load with a module-federation related error. Below are the steps I followed, the exact error, and what I’ve already checked.
Base: openmrs-distro-referenceapplication (cloned from the repo)
O3 frontend (running via Docker)
Created a sample ESM module using the esm template app (published to npm as @tjvosl/esm-hello-world-app)
I added the module to spa-assemble-config.json in the distro:
"@tjvosl/esm-hello-world-app": "next"
(the same name as package.json in my module)
docker build frontend
docker compose up
The module appears in the Implementer Tools → Frontend tab in O3, but when I open the module URL it fails to load.
Uncaught Error: application ‘@tjvosl/esm-hello-world-app-page-0’ died in status LOADING_SOURCE_CODE: The global variable _tjvosl_esm_hello_world_app does not refer to a federated module
Please rebuild your code and publish it to NPM. In the version in dist (which is what is loaded at runtime) it’s using the name _tj_esm_hello_world_app which aligns with @tj/esm-hello-world-app rather than what you actually published.
@tjayasinghe after adding the module in the spa-assemble-config did you do a build for the reference app again. Also try pointing to the exact version of your microfrontend and see what happens.
I fixed it. command should be docker compose build not docker build frontend. after doing this module loading correctly. thanks everyone for the support.