piercefreeman/mountaineer

Auto-reload client javascript

Closed this issue · 1 comments

Push updated code snippets to the page - leverage ESBuild to do this chunking.

Required: Javascript changes
Optional: PostCSS streaming

Initial implementation captured in #20. Our approach currently rebuilds all of the component files from scratch and forces a hard-refresh client side. This is in contrast to approaches (see here) that try to find the diff between the old state and new state the changes right into the current context. These approaches are nice because they're typically faster and maintain the current in-memory component state. The drawback is that the logic is more complicated and sometimes the diff doesn't properly capture all the changes, so the client side can get into an unexpected state.

If the current approach is too slow, we should first investigate general ways to make our build process faster since this will positively affect everything - not just auto reloading. At the moment maintaining the additional fast reloading capabilities probably isn't worth the effort.