module-federation-examples icon indicating copy to clipboard operation
module-federation-examples copied to clipboard

Problem to run example Modern.js ssr

Open alexandesigner opened this issue 1 year ago • 4 comments

I'm running the example without changing anything and when accessing localhost:3006 the remote applications don't run, the IP is being changed from localhost to 192.168.0.192.

Example link: https://github.com/module-federation/module-federation-examples/tree/master/modernjs-ssr

Access files directly with localhost is working correctly.

Reproduce: Screenshot 2024-08-28 at 12 52 34 Screenshot 2024-08-28 at 12 52 23

Is there any way around this change?

alexandesigner avatar Aug 28 '24 15:08 alexandesigner

Becasue node will auto resolve the localhost to ipv6/ipv4 via your /etc/hosts configuration . And it not support ipv6 now , so i will auto change the localhost to ipv4.

But it's very strange that you can not access the resource via ipv4, you can try add the config in moduleFederationPlugin : {remoteIpStrategy:'inherit'}

2heal1 avatar Sep 06 '24 02:09 2heal1

And what's the app of localhost:3009 ? Do you change the host 's port ?

If still not resolve the issue , please provide the env by the cmd npx envinfo --system --binaries --browsers

2heal1 avatar Sep 06 '24 02:09 2heal1

@2heal1 heeey..

thank you very much for your response!

the solution worked using the { remoteIpStrategy: 'inherit' } property.

However, based on what I see in the current typings, I believe we could enhance the documentation to explicitly include these configuration options within the plugin. What do you think?

And what's the app of localhost:3009 ? Do you change the host 's port ?

Just me changing the settings to see if it reflected haha

alexandesigner avatar Sep 10 '24 14:09 alexandesigner

Another problem I'm having is after the build... when I'm running the project, getting a CORS error, i don't know exactly if it's with module federation or in the modernjs project. Why with Garfish (modernjs mfe solution) I also get this error.

alexandesigner avatar Sep 10 '24 14:09 alexandesigner