Simulate Hot Code Push on Dev System?

I’m adding code from this thread to my app (adapted to work with React):

    Reload._onMigrate(function(retry) {
        setAppReloadIsReady(true);
        return [false];
    });

I would like to simulate Hot Code Push in my dev system in order to test the code. I tried:

  • Temporarily removing the hot-module-replacement package
  • Changing some server code
  • Turning the server on and off within my IDE

…but I haven’t found the way to do it yet.

What’s the correct way to simulate HCP on a dev system?

Where are you putting this code? It should be client-side. I put mine in a global file body.js, though I’m using Blaze so I’m not sure where you’d need to put it in React. Have you tried changing client-side code to trigger it?

2 Likes

Updating the client worked! I tried it before but I didn’t try it again after temporarily removing hot-module-replacement.

To answer your question, I have it running client side, in a useEffect:

useEffect(() => {
    Reload._onMigrate(function(retry) {
        setAppReloadIsReady(true);
        return [false];
    });
}, []);

Nice! Glad you got it working. It’s a great little feature.