Equivalent of "filename" in Native Federation Angular (after migration from Module Federation) for microfrontends?

45 Views Asked by At

I am working with Angular Module Federation for microfrontends. Our app consists of a big Host with lots of remote drivers that are loaded dynamicly. With Angular Module Federation, I had a simple config in every remote app:

module.exports = withModuleFederationPlugin({
  name: "DriverComponents",
 ** filename: "driver-front.js",**
  exposes: {
    "./CurrentStatusComponent":
      "./src/app/current-status/current-status.component.ts",
    "./HistoryComponent": "./src/app/history/history.component.ts",
    "./CommandsComponent": "./src/app/commands/commands.component.ts",
  },
  shared: {
    ...shareAll({
      singleton: true,
      strictVersion: false,
      requiredVersion: "auto",
    }),
  },
});

And in the host when the driver.js was needed I only had to load it with a simple get on http://localhost:4201/driver-front.js and the remote angular app was accessible from here. I can't use a manifest.json for this since it is dynamic.

My problem now is :

I want to migrate to angular new EsBuild which is faster, there is new version of Module Federation called Native Federation that doesn't use webpack to match the angular new build system... But native federation has a new way of using a config to expose remote components :

module.exports = withNativeFederation({
  name: "DriverComponents",
  exposes: {
    "./CurrentStatusComponent":
      "./src/app/current-status/current-status.component.ts",
    "./HistoryComponent": "./src/app/history/history.component.ts",
    "./CommandsComponent": "./src/app/commands/commands.component.ts",
  },
  shared: {
    ...shareAll({
      singleton: true,
      strictVersion: false,
      requiredVersion: "auto",
    }),
  },
});

The "filename" attribute is missing and I really can't find how to expose my remote built app in a .js file like previously (driver-front.js). There is not a lot of information online so thank you in advance if someone has an idea.

I tried to find help online on native-federation sites but no luck... I tried several different ways of writing my config but no luck either...

0

There are 0 best solutions below