telenko / node-mf-example

14 stars 3 forks source link

Discussion: dirty hack for client-side #2

Closed fatawesome closed 3 years ago

fatawesome commented 3 years ago

Hey, thanks for the library! I'm trying to setup federated SSR with Vue and having bad luck with the same place you implemented this obscure stuff. Just wanted to ask if you had any luck fixing it in a normal way?

The error I'm getting is about eager consumption (the same if use normal url instead of hack in your example).

telenko commented 3 years ago

Hi,

oh yes - that issue is a real pain. I don't have good solution, but i can recommend taking a look at this library:

@.***/nextjs-mf (but last time i was trying it together with my node-mf there was no luck).

I was planning to fix it or make another useful plugin for webpack5, but for now nothing :(

Hope it helps.

пн, 26 лип. 2021, 16:57 користувач Ilya Alonov @.***> пише:

Hey, thanks for the library! I'm trying to setup federated SSR with Vue and having bad luck with the same place you implemented this obscure stuff https://github.com/telenko/node-mf-example/blob/ad8b1283fc9cd6f1de28c8fd06bb6507755b308b/host/next.config.js#L14. Just wanted to ask if you had any luck fixing it in a normal way?

The error I'm getting is about eager consumption (the same if use normal url instead of hack in your example).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/telenko/node-mf-example/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACQO7RDNJLK2CDJXO66LFBTTZVSVDANCNFSM5BAFEYMA .

fatawesome commented 3 years ago

Thanks! Btw, maybe you did some research on the problem? Unfortunately, from first several hours spent I did not get any result :D

Kinbaum commented 3 years ago

Hey, I have a solution for that. You can do something like this:

remotes: {
    remoteLib: isServer
        ? "remoteLib@http://localhost:3002/node/remoteEntry.js"
        : "remoteLib@http://localhost:3002/web/remoteEntry.js"
}

Then you can add a custom loader to test for _app.js so that you can attach the share scope at runtime. This gets around the globalThis problem.

The only thing here is that the semver checks don't seem to work. The host and remote have to be on identical versions.

fatawesome commented 3 years ago

I will close this issue/discussion, as it seems to be solved :)