8

I am finding my way in the world of Webpack 5 module federation. There is a lot of good material and examples, like this and this.

However, all examples I found are built inside single Git repos, often using npm workspaces and/or nested package.json files.

Since I am going to implement module federation among multiple Git repositories, I'd like to see an example that does exactly that. Has anyone spotted such example?

I assume that the job is done in the definition of the remotes; I have seen some cases where the remote is defined through an URL, but in my case all remotes will be known at build time, so I guess an URL is overkill. Am I right?

Marco Faustinelli
  • 3,734
  • 5
  • 30
  • 49
  • 1
    I am also looking for the same. do you have any example explaining how to achieve module federation using multiple Git repositories? – Mohd. Shariq May 06 '22 at 06:51

1 Answers1

4

Yes, you don't have to mention the URL. I did not find any example handy but I tried following the same mono-repo example across two different repos. I did this:

On the micro-frontend app: output: { publicPath: '../[app-name]' }

On the shell-app: I used loadRemoteModule from '@angular-architects/module-federation'; just have to mention remoteEntry as the publicpath that you configured on MFE app so that it gets the remoteentry from there.

vp310
  • 300
  • 1
  • 9