Software⏱️ 2 min read📅 2026-05-30

How to Fix: Vite built .css file is not being used, page broken as old file is 404

Caching issue with Vite and Laravel deployment.

Quick Answer: Try clearing the browser cache, check for any outdated plugins or extensions, and verify that the Vite build process is producing the correct files.

Vite caching issues can be frustrating, especially when you're trying to deploy a Laravel application. In this scenario, the problem is that Vite's built CSS file is not being used due to a caching issue.

🔍 Why This Happens

  • When you run npm run build on the server, it generates a new set of CSS files. However, if the old CSS file is still cached in your browser or other cache services like Redis (which you mentioned you don't have), the page will continue to reference the old file.

🚀 How to Resolve This Issue

Method 1: Clear Browser Cache and Server Caches

  1. Step 1: Clear the browser cache by pressing Ctrl + Shift + R (Windows) or Cmd + Shift + R (Mac). Repeat this process a few times to ensure all cached files are cleared.

Method 2: Use Vite's Cache Clearing Command

  1. Step 1: Run the command npx vite --cache-clear on your server. This will clear all cached files, including CSS and JavaScript files.

✨ Wrapping Up

By following these steps, you should be able to resolve the issue with Vite's built CSS file not being used. Remember to always clear caches when deploying new versions of your application.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions