Skip to content

Instantly share code, notes, and snippets.

View zhuping's full-sized avatar
🎯
Focusing

贾克斯 zhuping

🎯
Focusing
View GitHub Profile
@ScriptedAlchemy
ScriptedAlchemy / getOrLoadRemote.js
Last active October 16, 2024 22:52
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'