Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can we have loose coupling between A Host and A Remote? #1

Open
idavollen opened this issue Mar 4, 2020 · 1 comment
Open

can we have loose coupling between A Host and A Remote? #1

idavollen opened this issue Mar 4, 2020 · 1 comment

Comments

@idavollen
Copy link

idavollen commented Mar 4, 2020

thanks for the great idea of Module Federation as well as this demo!

I've run this demo and it is cool, however I have some feeling of tight coupling between those concerned web apps, for instance, app-01 public/index.html has to reference to these two dynamically generated remote-entry by WebPack based on options to ModuleFederationPlugin defined in the other two Remotes respectively, which has added hard-coded dependency between app-01 and app-02, app-03. If any of app-02, app-03 makes change on filename in options to ModuleFederationPlugin, MF in app-01 will break down unless app-01 is changed accordingly and deployed again.


<head>
    <script src="http://localhost:3002/remoteEntry.js"></script>
    <script src="http://localhost:3003/remoteEntry.js"></script>
</head>


I am wondering if ModuleFederationPlugin could dynamically insert these two concerned <script> tags under <head> in the template public/index.html during execution of Webpacking since HtmlWebpackPlugin comes after ModuleFederationPlugin

Alternatively how about to have a module discovery/registry as a service discovery does on backend, i.e Consul Each Remote will automatically register itself while starting up and A Host can fetch details of A Remote from the module discovery. In this way, A Host is a bit more loosely coupled with A Remote.

Hopefully my thoughts will make sense for you :)

@hanford
Copy link

hanford commented Apr 12, 2020

@idavollen noticed the same thing, would be great if this happened automagically .. though I understand if that's not in scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants