我使用角模块联合插件创建了两个角模块联合应用程序,但在加载远程组件错误图像链接后遇到了一个错误Uncaught (in promise): TypeError: container.init is not a function。
我找到了这个github发布线程,解决方案是在webpack.config.js文件的output部分中添加scriptType: 'text/javascript',但是它对我不起作用。
如果您需要更多关于应用程序的详细信息,这里有主机和远程存储库的链接。
@angular/cli版本是13.0.2
@angular-architects/module-federation版本是14.2.3。
谢谢。
发布于 2022-04-19 12:52:43
使模块联邦为角独立项目工作。
刚刚将Webpack 安装为一个dev依赖项.
Webpack没有被列在package.json的依赖项中,我通过node_modules文件夹查看了它的版本,它是5.64.0。
发布于 2022-08-09 13:03:47
我正在使用angular v14.1.1和"@angular-architects/module-federation": "^14.3.10", "@angular-architects/module-federation-tools": "^14.3.10", "ngx-build-plus": "^14.0.0"。
在评论了library属性部分后,remote mfe app webpack.config.js,它为我工作。
module.exports = withModuleFederationPlugin({
name: "angular14",
// library: { type: "var", name: "angular14" },
filename: "remoteEntry.js",
exposes: {
'./web-components': './src/bootstrap.ts',
},
shared: {
...shareAll({ singleton: true, strictVersion: true, requiredVersion: 'auto' }),
},
});不知道原因是什么,但也可以帮助别人这一点。
https://stackoverflow.com/questions/71830108
复制相似问题