Macil / browserify-hmr

Hot Module Replacement plugin for Browserify
MIT License
373 stars 26 forks source link

Updatest printed to browser console but not actually happening. #16

Closed Industrial closed 8 years ago

Industrial commented 8 years ago

Hi.

I'm trying to set up this project with HMR but I can't seem to get file updates actually injected/changing the browser.

https://gist.github.com/Industrial/36c747860fad05259a2b

Macil commented 8 years ago

Are the files that you want to be live-reloaded using module.hot or defining React components? If not, then the "Updated modules" log line is misleading and being caused by this bug: https://github.com/AgentME/browserify-hmr/issues/14. You'll need to define your modules to be reloadable by using module.hot or by defining React components (which react-transform-hmr sees and wraps with module.hot usage).

Industrial commented 8 years ago

I got the problem fixed.

We were using plain functions as react components, and not subclasses of React.Component.

Macil commented 8 years ago

Right, react-transform-hmr doesn't currently recognize components as functions: https://github.com/gaearon/react-transform-hmr/issues/6