hot pushes not working with React code

Hello all,

I am having problems with getting hotpush to work on Meteor when using React / react-template-helper

I have added react and react-template-helper to the project using
npm install --save react react-dom
meteor add react-template-helper

When I build the project it runs on device, I can see the react components. However when the same working code is hot pushed from the server, the app reloads and get stuck on white screen. In the inspector I can see these errors:

Error: Cannot find module 'react/package.json'(…)
7c52702df8cab1d59be81025272d43c498547079.js?meteor_js_resource=true:295 Error: Cannot find module 'react-dom/package.json'(…)
7c52702df8cab1d59be81025272d43c498547079.js?meteor_js_resource=true:295 WARNING: npm peer requirements (for react-template-helper) not installed:
 - react@15.x not installed.
 - react-dom@15.x not installed.

Read more about installing npm peer dependencies:

7c52702df8cab1d59be81025272d43c498547079.js?meteor_js_resource=true:11 Uncaught Error: Cannot find module 'react'

Once I remove the react code, hot push works again.

Anyone encounter this problem before?

Hello, I do not have such an issue, you can try my boilerplate here https://gitlab.com/priezz/meteor-react-hot.git, it uses awesome gadicc:ecmascript-hot package for immediate hot-reload (w/o waiting a few seconds). However I do not use react-template-helper here, but I do not think this is the source of your problem.

Thank you very much for the boilerplate priezz, it seems like a very good skeleton for React projects.

My hot push problem only happens when it’s hot pushed to a device from a remote server . Did you manage to get it to work in this scenario?

Yes, the boilerplate woks in this scenario as well. While the device is directly connected to the server (i.e., through the local network) react hot reload is used (immediate), when you access the server through the proxy or tunnel (i.e., via ngrok), page is reloaded by Meteor’s native HCP (an it takes a few seconds in this case).

The problem is with our build script, after adding ‘npm install’ into the build process things are working again.