@buxlabs/hot-reload

hot reload tcp-websocket server

Usage no npm install needed!

<script type="module">
  import buxlabsHotReload from 'https://cdn.skypack.dev/@buxlabs/hot-reload';
</script>

README

hot-reload

Codeship Status for buxlabs/hot-reload

npm version

npm install @buxlabs/hot-reload

websocket server for hot reloads in single page apps

The server acts as a proxy - it emits received data as an ws event that can be listened to in a front-end app

start

The server works on port 10009 by default, to start it run:

node bin/ws

To override the port simply:

PORT=12345 node bin/ws

motivation

Watching dist files is a common solution for hot reload, it has some disadvantages though:

  • it might have an uncomfortable latency for bigger apps or consume a lot of memory/cpu usage,
  • it's tricky to test

The second server approach lets you:

  • keep websocket dependency out of your app,
  • ignore file watching by sending a request on save instead