FredKSchott / snowpack

ESM-powered frontend build tool. Instant, lightweight, unbundled development. ✌️
https://www.snowpack.dev
MIT License
19.48k stars 922 forks source link

🐛 BUG: Svelte quick start does not explain how to enable fast reloads #3569

Open Plecra opened 3 years ago

Plecra commented 3 years ago

Quick checklist

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the bug

https://github.com/rixo/svelte-hmr#preservation-of-local-state

A while ago, the default behaviour of svelte HMR was changed to reset component-local state, and variables which should be preserved need to be annotated with // @hmr:keep. The quick start on the website (and the templates in the repo) do not use this, so their fast reloading demo is broken. Anecdotally, this was pretty confusing for me getting started :D

Steps to reproduce

  1. npx create-snowpack-app using template @snowpack/app-template-svelte
  2. npm start in the new directory
  3. Edit some text in App.svelte and save
  4. The value of the timer is reset, instead of continuing to increase

Link to minimal reproducible example (optional)

No response

rob-myers commented 3 years ago

Thanks for explaining this, it was totally confusing.