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

1.7k Views Asked by At

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.

Uncaught SyntaxError: Unexpected token ':'

Error occurring with the below code in 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.

Please assist.

1

There are 1 best solutions below

0
On

While mentioning remotes in ModuleFederationPlugin, You do not have to mention name and filename. Put like this:

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

})