简体   繁体   English

Module Federation - Uncaught SyntaxError: Unexpected token ':' Angular 13 while using MFE

[英]Module Federation - Uncaught SyntaxError: Unexpected token ':' Angular 13 while consuming MFE

I am trying to consume an MFE using webpack 5, module federation with angular 13. However when I run the application I am getting below error.我正在尝试使用 webpack 5 使用 MFE,使用 angular 13 的模块联合。但是,当我运行应用程序时,我遇到了错误。

Uncaught SyntaxError: Unexpected token ':'未捕获的 SyntaxError:意外的标记“:”

Error occurring with the below code in webpack.config webpack.config 中的以下代码发生错误

 new ModuleFederationPlugin({
      name: "shell",
      filename: "remoteEntry.js",           
      remotes: {
                MfeAccount: "https://account-mfexyz.com/remoteEntry.js"
              },
})

To me everything looks good, but still application not able to access remote MFE, and throwing error.对我来说,一切看起来都不错,但应用程序仍然无法访问远程 MFE,并抛出错误。

Please assist.请协助。

While mentioning remotes in ModuleFederationPlugin, You do not have to mention name and filename.在 ModuleFederationPlugin 中提及遥控器时,您不必提及名称和文件名。 Put like this:像这样放:

 new ModuleFederationPlugin({          
  remotes: {
            MfeAccount: "https://account-mfexyz.com/remoteEntry.js"
          },

}) })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM