Skip to content

Instantly share code, notes, and snippets.

@ScriptedAlchemy
ScriptedAlchemy / getOrLoadRemote.js
Last active December 20, 2024 21:14
The Right Way to Load Dynamic Remotes
import { injectScript } from '@module-federation/utilities';
// example of dynamic remote import on server and client
const isServer = typeof window === 'undefined';
//could also use
// getModule({
// remoteContainer: {
// global: 'app2',
// url: 'http://localhost:3002/remoteEntry.js',
// },
// modulePath: './sample'