The current Browserify-HMR example relies on a bug in Browserify-HMR. The plugin shouldn't do anything for code that never calls module.hot.accept but it currently has a bug that would cause the example to work. Sorry about that!
The example using ud.defn works because that function calls module.hot.accept, but the use of ud.defn is superfluous because there's no need to update the pre-existing render function. The new execution of the module executes its own new render function. No reference to the older version of the render function is kept around. (If the render function was exported, then ud.defn would be useful in order to update the old render function that other modules have already imported.) I need to work on the documentation around ud more. I don't think it should be in brief HMR examples like here.
I also added a mention of react-hot-transform and described how it was different from livereactload immediately before it.
The current Browserify-HMR example relies on a bug in Browserify-HMR. The plugin shouldn't do anything for code that never calls
module.hot.accept
but it currently has a bug that would cause the example to work. Sorry about that!The example using
ud.defn
works because that function callsmodule.hot.accept
, but the use ofud.defn
is superfluous because there's no need to update the pre-existingrender
function. The new execution of the module executes its own newrender
function. No reference to the older version of therender
function is kept around. (If therender
function was exported, thenud.defn
would be useful in order to update the oldrender
function that other modules have already imported.) I need to work on the documentation aroundud
more. I don't think it should be in brief HMR examples like here.I also added a mention of react-hot-transform and described how it was different from livereactload immediately before it.