FredKSchott / esm-hmr

a Hot Module Replacement (HMR) API for your ESM-based dev server.
MIT License
413 stars 11 forks source link

Support: Servor #4

Closed FredKSchott closed 4 years ago

FredKSchott commented 4 years ago

/cc @lukejacksonn

I'm not sure if you have any interest in implementing HMR on Servor, but I'd still love to hear your thoughts on this.

Check out the reference implementation in the repo. Feel free to grab that file, it should be all you need on the client-side to add HMR support to Servor. Server-side, you'd only need to add to your /livereload the ability to send down updates of individual files/urls that have changed instead of full "reload" events. The client-side would then decide if a full-page reload was required or if an an individual file update could be handled via HMR.

lukejacksonn commented 4 years ago

This sounds very promising and the implementation makes a lot of sense. Sending the name of the file that changed is something I'd thought about before (inspired by how hot reloading css used to happen).

I never dared dig into how it might work for JS but luckily the likes of you and Jovi are on the case! Will take a closer look and get back to you with any thoughts!

FredKSchott commented 4 years ago

Sounds good! Closing this issue, but feel free to create new ones for any specific issues that come up