vite plugin for module federation
https://module-federation.io/guide/basic/webpack.html
// vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import mf from "module-federation-vite"
import topLevelAwait from "vite-plugin-top-level-await";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
mf({
name: "bbc",
remotes: {
mfapp01: "mfapp01@https://unpkg.com/[email protected]/dist/remoteEntry.js",
remote2: "mfapp02@https://unpkg.com/mf-app-02/dist/remoteEntry.js",
remote3: "remote1@https://unpkg.com/[email protected]/dist/mf-manifest.json",
// "remote4": {
// entry: "http://localhost:5174/dd/remoteEntry.js",
// globalEntryName: "bb",
// type: "esm"
// }
},
exposes: {
"App": "./src/App.vue"
},
filename: "dd/remoteEntry.js",
shared: {
vue: {
},
react: {
requiredVersion: "18"
}
},
}),
// If you set build.target: "chrome89", you can remove this plugin
// topLevelAwait(),
],
build: {
target: "chrome89"
}
})