A development server helps you see your app live as you build it. HMR (Hot Module Replacement) updates parts of your app instantly without reloading the whole page.
Development server and HMR in Svelte
npm run dev
This command starts the development server with HMR enabled by default in SvelteKit or Vite projects.
You usually run this in your project folder terminal to start live reloading.
npm run dev
vite --host
This simple Svelte component shows a button that increases a count when clicked. When you run npm run dev, the development server shows this button. If you change the text or logic, HMR updates the page instantly without full reload.
<script> let count = 0; </script> <button on:click={() => count++} aria-label="Increment count"> Count: {count} </button>
HMR keeps your app state, so you don't lose data when you change code.
Use the browser's developer tools console to see errors or logs while running the dev server.
Development server is only for coding time; for production, build your app with npm run build.
Development server shows your app live and updates it as you code.
HMR updates only changed parts instantly without full page reload.
Run npm run dev to start the server with HMR in Svelte projects.