micro-front-end
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

62 lines
1.6 KiB

const ModuleFederationPlugin = require("webpack/lib/container/ModuleFederationPlugin");
const mf = require("@angular-architects/module-federation/webpack");
const path = require("path");
const share = mf.share;
const sharedMappings = new mf.SharedMappings();
sharedMappings.register(path.join(__dirname, "tsconfig.json"), []);
module.exports = {
output: {
uniqueName: "mef3",
publicPath: "auto",
},
optimization: {
runtimeChunk: false,
},
resolve: {
alias: {
...sharedMappings.getAliases(),
},
},
plugins: [
new ModuleFederationPlugin({
name: "mfe3",
filename: "remoteEntry.js",
exposes: {
"./Module3": "./src/app/microfrontend3/microfrontend3.module.ts",
},
shared: share({
"assets/img": { eager: true },
"@angular/core": {
singleton: true,
strictVersion: true,
requiredVersion: "auto",
},
"@angular/common": {
singleton: true,
strictVersion: true,
requiredVersion: "auto",
},
"@angular/common/http": {
singleton: true,
strictVersion: true,
requiredVersion: "auto",
},
"@angular/router": {
singleton: true,
strictVersion: true,
requiredVersion: "auto",
},
"my-shared": {
singleton: true,
strictVersion: true,
import: "my-shared", // 对应库的npm包名或本地路径
requiredVersion: "*", // 或者具体的版本号,如"0.0.1"
},
...sharedMappings.getDescriptors(),
}),
}),
sharedMappings.getPlugin(),
],
};