Today, while developing a new feature in my app at work (which is a VueJS based app using Vite as the bundler), I got the following error in the browser console while running the app in dev mode:

504 (Outdated Optimize Dep)

First thing I tried was to do a shift-refresh in Chrome to clear out the cache. Unfortunately, this didn't help.

A quick search on trusty StackOverflow indicated that the problem could be the Vite cache. I therefor updated the package.json file to include the --force flag:

{
  "scripts": {
    "dev": "vite  --force",
  },
}

I then re-ran the dev command and the problem was gone…

npm run dev

This cleared out the cache from Vite which was the actual problem. For a list of all Vite CLI flags, you can check the documentation.