Hot module replacement?
See original GitHub issueSo I’m going to start with the the premise that Hot Module Replacement™ should be as easy and pluggable as https://github.com/substack/react-starter-hmr, with minimal change to the client application.
This is a rough-guide on what is required to get it set up:
- Install the dependencies:
npm i --save-dev browserify-hmr ud
- Add the plugin to the browserify/watchify bundler
watchify client.js -p browserify-hmr ...
- Add the
ud.defn(...)
annotation to the part of the application to show which bits of the program are suitable for hot-reload (per screenshot above) - Watch view updates appear insta-matically in the page without losing state
My trouble is that with step 4.
I couldn’t find a way with choo to force a re-render of the page’s current state like in the React example. I got close in two different ways - forcing a reboot of the entire app (so reverting to initial state) or views updating the next time they were rendered (not insta-matically).
If anyone knows the secret to getting this set up, please tell! Otherwise if a change is required in choo to facilitate this, let’s figure it out? I think it’s going to be something like exposing a way to call render/re-render, unless I’m missing something!
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (13 by maintainers)
Top GitHub Comments
I’ve published v1 of both https://github.com/bengourley/choo-resume and https://github.com/bengourley/hot-rld.
@yoshuawuyts hot-rld now supports css too.
I’d favor the approach in hot-app-replacement because:
Hah yeah so that’s about it - obviously you’re free to do what you want, but this is my take on it (:
On Wed, Oct 26, 2016 at 6:59 PM Ben Gourley notifications@github.com wrote: