小编gle*_*erp的帖子

Webpack 模块联合共享单例模块 @angular/common 的版本 11.xx 不满足(需要 ^7.2.0)

我正在尝试让我相当复杂的整体应用程序与模块联合一起使用。我的 webpack 配置看起来像这样

   plugins: [
    new ModuleFederationPlugin({
        remotes: {
            "mfe1": "mfe1@http://localhost:3000/remoteEntry.js",
        },
        shared: {
          "@angular/core": { singleton: true, strictVersion: true },
          "@angular/common": { singleton: true, strictVersion: true },
          "@angular/router": { singleton: true, strictVersion: true },
          ...sharedMappings.getDescriptors()
        }
    }),
    sharedMappings.getPlugin(),
  ],
Run Code Online (Sandbox Code Playgroud)

微前端方面的共享是相同的。当我尝试运行该应用程序时,我得到:

错误:共享单例模块@angular/common的版本11.2.1不满足(需要^7.2.0)

在此之前,我收到了类似的错误消息,但针对的是角度/核心。我通过重新运行纱线并修复库根据不同的角度/核心版本产生的所有警告来解决这个问题。

但由于错误 fpr Angular/common 我陷入困境。我不知道如何找出哪个库可能会产生该错误。

webpack angular webpack-5 webpack-module-federation

15
推荐指数
1
解决办法
2万
查看次数