hot-loader / react-dom

🔥 version of React-DOM
110 stars 11 forks source link

Make patched UMD version (for use with external react-dom) #38

Open mareolan opened 4 years ago

mareolan commented 4 years ago

Current npm package 16.13.0 contains patched version of react-dom in CJS format only. There is actually also umd/react-dom.development.js file, but it contains unpatched version - there is difference in createFiberFromTypeAndProps function when compared with CJS version (it's missing type = hotResolveType(type);) and without that the application loading fails with AppContainer should be patched.

Having UMD build of @hot-loader/react-dom, or a script for applying the patch to the UMD build of react-dom, would make the hot reloading work in applications which load react and react-dom externally.

PS: the patch.js script referenced from README currently works only if applied to CJS version, probably because react-dom UMD build has extra indentation and the patch uses string.replace without regexps.

theKashey commented 4 years ago

The ecosystem started slowly moving to the react-native implementation of hot reloading (fast-refresh), there are at least 3 different libraries implementing it, and I am not able to recommend any particular one.