我正在按照以下链接使用 Angular Module Federation 创建 MFE。
https://github.com/benorama/mfe-basic-demo
运行项目后,
ng serve mfe1
我可以看到在终端中生成了块文件,但是当我在文件资源管理器中看到时实际上没有文件,我找不到mfe1RemoteEntry.js
这是我的 webpack 文件,
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'),
[/* mapped paths to share */]);
module.exports = {
output: {
uniqueName: "mfe1",
publicPath: "auto"
},
optimization: {
runtimeChunk: false
},
resolve: {
alias: {
...sharedMappings.getAliases(),
}
},
plugins: [
new ModuleFederationPlugin({
name: "mfe1",
filename: "mfe1RemoteEntry.js",
exposes: {
'./TodoModule': './projects/mfe1/src/app/todo/todo.module.ts',
},
shared: share({
"@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' },
...sharedMappings.getDescriptors()
})
}),
sharedMappings.getPlugin()
],
};
请问有什么想法吗?