A simple script to reload a microfrontend application.
This tool is designed to work in development mode and helps automatically reload the shell application when changes are detected in remote microfrontend applications.
- Supports Angular microfrontend applications.
- Uses WebSocket for live reload functionality.
- Easy integration with your shell application.
Install the package via npm:
npm install npm-mfe-live-reload
- Add
LiveReloadService
to your shell app (e.g., viaAPP_INITIALIZER
).import { LiveReloadService } from 'npm-mfe-live-reload'; { provide: APP_INITIALIZER, useFactory: (liveReloadService: LiveReloadService) => () => { if (environment.env === 'local') { liveReloadService.initialize(); } return Promise.resolve(); }, deps: [LiveReloadService], multi: true }, { provide: LiveReloadService, useFactory: () => { if (environment.env === 'local') { try { return new LiveReloadService(); } catch (e) { console.error('LiveReloadService initialization failed:', e); } } return { initialize: () => {}, connect: () => {}, disconnect: () => {} }; } },
- Start the development server:
npx mfe-live-reload -- ../remote-app-1 ../remote-app-2
- These paths should point to the source folders of your remotes (not
./dist
).
- These paths should point to the source folders of your remotes (not
- When a remote changes, the shell app will auto-reload.
- This only runs in development mode (
isDevMode()
).
-
build: Builds the project using
tsup
.
MIT License
Stefan Zota