Safe to Delete

Vite Bundler Cache Folder (node_modules/.vite)

Quick Answer: The node_modules/.vite folder caches pre-bundled ES modules for Vite dev servers. Deleting it is safe and fixes stale dev server HMR bugs.

Bottom Line: It is 100% safe to delete the node_modules/.vite folder. Deleting it will not affect your web application source code or installed npm packages.


What is the node_modules/.vite Folder?

Located inside JavaScript and TypeScript projects at node_modules/.vite, this folder is created by the Vite build tool / dev server (used by Vue, React, Svelte, and Astro).

When you run npm run dev or vite, Vite pre-bundles your node_modules dependencies into native ES modules (ESM) using esbuild and saves them in .vite. This gives Vite its near-instant dev server startup times.

Over time, as dependency packages change, stale pre-bundled chunks accumulate inside .vite.


Can You Delete node_modules/.vite?

✅ Yes, it is completely safe to delete.

  • No source code risk: Your src/ files, package.json, and assets remain untouched.
  • Fixes HMR & import bugs: Deleting .vite is the official fix when Vite’s Hot Module Replacement (HMR) gets stuck or throws Failed to resolve import errors.
  • Auto-regenerated: Vite will automatically recreate .vite the next time you start the dev server (vite --force).

How to Safely Clean Up Vite Cache

Run your dev server with the --force flag:

npx vite --force

Method 2: Manual Cache Deletion

Delete the .vite directory directly:

# macOS / Linux
rm -rf node_modules/.vite

# Windows (Command Prompt)
rmdir /s /q node_modules\.vite

# Windows (PowerShell)
Remove-Item -Recurse -Force node_modules/.vite

Discussion

Loading authentication...

Related in developer

The AI Engineer's Model Disk Cleanup Guide: Hugging Face, Ollama & PyTorch

The ultimate 1,200-word field guide for AI developers and local LLM hobbyists to reclaim 200GB+ from Ollama, Hugging Face, PyTorch, and vLLM model weights.

Safe to Delete

Android Studio System Index Cache (AndroidStudio Cache)

Android Studio caches Gradle project indexes, VFS caches, and compiler artifacts. Invalidate and clear is safe.

Safe to Delete

Ansible Automation Temp & Fact Cache (~/.ansible/tmp)

Ansible stores temporary playbook execution modules and target host fact JSON caches in ~/.ansible/tmp. Clearing Ansible tmp is safe.

Safe to Delete
Back to all files