Save the file. Skip the manual refresh

With the dev server running, saving a source file updates the browser without a manual refresh.

Still hitting refresh after a save? With the dev server running, the browser updates itself. That tab has to be npm run dev, not vite preview. When the UI sketch needs a shared page, start a room.

Stop when the Local URL from the terminal is open and a save changes that tab. Search query: Vite hot update on save, no manual refresh.

create vitenpm run devsave
5173default port
20.19+minimum Node
devnot preview

Start the dev server first

  1. 1
    Check Node

    The guide requires Node.js 20.19+ or 22.12+. If a template warns about a higher version, upgrade.

  2. 2
    Scaffold

    Run npm create vite@latest and follow the prompts. For Vue SFCs with first-party HMR: npm create vite@latest my-vue-app -- --template vue. On npm 7+ the extra -- is required. The same page lists yarn, pnpm, bun, and deno; this walkthrough uses npm.

  3. 3
    Install and start

    In the new directory, npm install, then npm run dev. The scaffold script is "dev": "vite", with aliases vite dev and vite serve.

  4. 4
    Open the printed URL

    The default is http://localhost:5173. Use --port to change it and --open to launch the browser. Trust the Local URL in the terminal.

Save once and watch the tab

Edit an imported .css file, a Vue single-file component, or a React component, then save. The features page: importing a CSS file injects it through a style tag with HMR. Vue SFCs and React Fast Refresh are first-party; Preact uses @prefresh/vite. The create-vite template you picked is already wired.

npm create vite@latest my-vue-app -- --template vue
cd my-vue-app
npm install
npm run dev
# Local: http://localhost:5173

Shortest path with no framework

Manual install from the guide: npm install -D vite, put index.html in the project root (Vite treats it as the module-graph entry, not a file under public), then npx vite. Same default, http://localhost:5173. To see a hot update, import a CSS file and save a change to it.

npm install -D vite
# index.html
# <p>Hello Vite!</p>
npx vite

Two pages that look like a failure

preview and dist

vite build emits static files. vite preview only serves them locally. That page has no dev-server hot update.

Types can be wrong while the page moves

Type checking is outside Vite’s transform. Run tsc --noEmit --watch separately, or vite-plugin-checker. A visual update is not a passing typecheck.

A manual refresh means you are not on the dev server. The update after save comes from npm run dev.

Once the command matches the tab, put the UI sketch on one page: guide · start a room

Do I have to pick Vue or React?

No. An imported CSS file uses HMR, per the features page. Vue SFCs and React Fast Refresh are the layer create-vite already configures so an update need not wipe page state.

I saved and nothing moved.

You are likely on vite preview, a dist folder, or the dev server is not running. Use the Local URL printed by npm run dev.

The port is not 5173.

Use the URL the terminal printed. Pass --port to pin it. --open launches the browser for you.

Will a type error still update the page?

Yes. Vite transpiles TypeScript and does not type-check. For types, run tsc --noEmit --watch.

Start a room