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

Should fast refresh hmr work?

Open tom-sherman opened this issue 2 years ago • 3 comments

I see it's disabled right now, enabling it works for the host app but not the remotes.

Is this expected? Is there a way to get it to work?

tom-sherman avatar Feb 16 '22 22:02 tom-sherman

Yes this is expected. Based on my knowledge it's not possible without some magic trickery inside Re.Pack and generated code. To me the cost and shakiness of such support is not really worth it and I would suggest to develop apps/containers in standalone more for HMR.

zamotany avatar Feb 25 '22 15:02 zamotany

I think there's some prior art on the web: https://github.com/module-federation/module-federation-examples/blob/master/react-hmr/README.md

Is there anything that can be taken and ported to native? Would this model work? Or is there some drawback in repack that prevents it?

tom-sherman avatar Feb 25 '22 15:02 tom-sherman

Looks like the example from the link is missing some files/implementation.

Aside from that, Re.Pack has custom Webpack HMR client. The default one doesn't work for React Native. The main problem with HMR in MF is that we would need to be able to differentiate if the update should do HMR in which container. Right now, I'm not sure where would the potential blocker be. It might be Webpack, Re.Pack or @pmmmwh/react-refresh-webpack-plugin problem or a combination of them.

zamotany avatar Feb 25 '22 15:02 zamotany