Svelte Hot Reloading Issue

Ben Dev picture Ben Dev · Apr 25, 2019 · Viewed 7.5k times · Source

Recently started playing with Svelte using the sveltejs template. Everything is working fine, however when I do any change in the files it doesn't hot reload the changes to the web browser, so I have to manually refresh the page to see the changes. Is there any option in the settings to enable that feature or is it not possible at this point?

Answer

Rich Harris picture Rich Harris · Apr 25, 2019

The default template (https://github.com/sveltejs/template) uses Rollup, which doesn't support hot module reloading. The webpack version (https://github.com/sveltejs/template-webpack) will support HMR, but first we need to add some hooks to Svelte itself to make it possible. There's an issue you can track here — hopefully we'll be able to do this work soon.

Until then, Tholle's suggestion of using the livereload plugin is probably the best compromise.