Hot Module Reloading

Published on

I was playing with Snowpack3 the other night after reading about some new stuff with it and with Vite2. Just trying to see what the hype was about with Hot module reloading (HMR), and honestly it somewhat lives up to the slogan of “Once you try it, it’s impossible to go back to anything else” from snowpack.dev

I have this little sample app that you can try your self to see HMR with Svelte in action.

What makes me feel a little old is that I remember experimenting with something like HMR back with Spine.js and Hem. Part of the problem was that js didn’t have a proper module system back then. Anyway, it’s cool to actually play with a working version of this idea.

I wonder about switching out Webpack for Snowpack in our main fronted project at work. This is all the more possible if the risk involved with just completely moving to ES2017 and forgetting all about the old browsers at this point is actually rather small.

The I tried one other dev tooling setup that is still in the early stages - Snel. I Really like the idea of Deno as a node replacement, but as for Snel, I couldn’t quite get the HMR portion of it going.

The shortened feedback loop with HMR really has huge potential to positively impact the development experience. Very very fast reloads is cool, definitely, but not losing state feels like maybe the really big win. One of the things I like about Cypress_io is having tests with dangling state - Gets you right back to where you were if you had some complex state that needs to be in place. Not ever losing that state at all is obviously better. I haven’t yet tried if HMR works inside of a Cypress test. Seems like could get some weird side effects in attempting that though.

Hmm. More experiments to come.