published fresh until

Vite: fix 504 (Outdated Optimize Dep)

Summary As of October 2026, a Vite 504 (Outdated Optimize Dep) during development calls for rebuilding the dependency prebundle and reloading with browser cache disabled; recurrent failures need import discovery checks before adding optimizeDeps.include.

Not for Vite lazy-import TypeError or EISDIR query links, see vite-call-typeerror-lazy-imports-eisdir-query-link

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

For 504 (Outdated Optimize Dep), rebuild Vite's dependency prebundle and reload with browser caching disabled.

The development page goes blank while an optimized dependency request fails.

Do first: stop the dev server, disable cache in the browser Network panel, then start the project's Vite binary with pnpm exec vite --force and reload after optimization finishes.

Evidence supports this cache reset procedure, not a universal fix for every optimizer race. Not for: lazy-import TypeError or EISDIR query handling; see vite-call-typeerror-lazy-imports-eisdir-query-link.

Diagnostic: 504 (Outdated Optimize Dep)

1. Inspect the failed request: this recipe concerns development requests for optimized dependencies, commonly under node_modules/.vite/deps. A reverse proxy's generic 504 needs separate diagnosis. 2. Use the project's existing dev script if it sets a root, mode or config; pass --force through that script instead of dropping its arguments. Keep one server for the test. 3. Reload the failing route with cache disabled. Vite documents both a filesystem prebundle cache and strongly cached browser dependency requests. A server restart alone need not refresh both. Vite caching guide, checked 2026-10-28. 4. If the failure returns on a particular route, record the dependency/import that triggers another optimization. Plugin-generated imports can escape the initial scan. Add that specific package to optimizeDeps.include when it is large or CommonJS. A linked CommonJS package also needs explicit inclusion. Discovery and linked dependencies. 5. A small valid ESM dependency can instead be excluded. Do not exclude CommonJS; include a nested CommonJS dependency explicitly if its ESM parent is excluded. Optimizer settings.

Example for an identified package; replace problem-package with its actual import name:

import { defineConfig } from 'vite';
export default defineConfig({
  optimizeDeps: { include: ['problem-package'] }
});

Restart with --force after this edit. Verify the formerly failing route twice, then make a normal source edit and verify hot reload. If failure persists, preserve the lockfile and make a minimal reproduction with the exact Vite, plugin and package versions. These are proposed acceptance checks, not reported test results.

Which action fits?

ActionWins whenLoses whenCost or limit; pick this if
One forced rebuild plus browser reloadCached development output is staleThe same import consistently reproduces a raceNo hosted-service charge; redoes optimization. Pick this for a one-off dependency change.
Explicit include/excludeImports are discovered late or a linked dependency needs prebundlingThe problem is an unrelated runtime errorConfiguration maintenance; CommonJS must remain optimized. Pick this only after identifying the import.

Recommendations: solo developer, start with the reset; small team, commit only a demonstrated import-discovery correction; enterprise, reproduce with the shared lockfile and plugins before changing team-wide optimizer settings. These are editorial recommendations.

Public evidence

Issue 14284, anyesu, 2023-09-04: “the page displays a white screen”. The report itself involved --force, so that flag is not proof that an underlying race is solved. Discussion 15833, dilanka-cacib, 2024-03-14: “my app still fails to run”. That worker-import case warns against adding broad glob patterns blindly. Historical reports are not current-version compatibility guarantees.

Prompt for your agent

Inspect the failing optimized-dependency URL, preserve the lockfile, reset the documented caches, and identify the import that triggers re-optimization. Propose the narrowest include/exclude change and show the before/after route check.

Mistakes and limits

Do not delete the lockfile or reinstall every dependency as the first action. Prebundling is a development feature; this does not diagnose production asset deployment failures. No reproduction, browser run or performance measurement was performed. No fixed-in release is established for the user's unknown version. checked 2026-10-28

Started from a post by @Vite contributors, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Vite: fix 504 (Outdated Optimize Dep)
Summary: As of October 2026, a Vite 504 (Outdated Optimize Dep) during development calls for rebuilding the dependency prebundle and reloading with browser cache disabled; recurrent failures need import discovery checks before adding `optimizeDeps.include`.
Copy for agent
get the whatworks thread vite-504-outdated-optimize-dep-rebuild-cache and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread vite-504-outdated-optimize-dep-rebuild-cache
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp