Skip to content

docs: clarify production build caching - #21980

Closed
lilianakatrina684-a11y wants to merge 1 commit into
vitejs:mainfrom
lilianakatrina684-a11y:docs-clarify-build-caching
Closed

lilianakatrina684-a11y wants to merge 1 commit into
vitejs:mainfrom
lilianakatrina684-a11y:docs-clarify-build-caching

Conversation

@lilianakatrina684-a11y

Copy link
Copy Markdown

Summary

  • clarify that cacheDir is mainly a dev cache and isn't reused as a persistent cache for production builds
  • explain in the build guide that repeated �ite build runs are expected to transform and bundle the app again

Closes #19214

@lilianakatrina684-a11y lilianakatrina684-a11y changed the title docs: Clarify production build caching docs: clarify production build caching Mar 29, 2026
@santhiprakash

Copy link
Copy Markdown
Contributor

Hi @lilianakatrina684-a11y — the dev-cache vs production-build clarification here looks useful.

While reading this paragraph I noticed an adjacent inaccuracy that would fit naturally into your edit if you're open to folding it in: the trailing sentence still reads

Default to .vite when no package.json is detected.

That doesn't match the actual resolution in resolveCacheDir (packages/vite/src/node/config.ts):

if (config.cacheDir) {
  cacheDir = path.resolve(resolvedRoot, config.cacheDir)
} else if (pkgDir) {
  cacheDir = path.join(pkgDir, `node_modules/.vite`)
} else {
  const nodeModulesDir = path.join(resolvedRoot, 'node_modules')
  cacheDir = fs.existsSync(nodeModulesDir)
    ? path.join(nodeModulesDir, `.vite`)
    : path.join(resolvedRoot, `.vite`)
}

So the bare .vite fallback only happens when neither a package.json nor a node_modules directory is detected — e.g. a Deno project with node_modules but no package.json still resolves to node_modules/.vite.

#23060 already corrected the JSDoc in config.ts to match this, but the user-facing docs here kept the older wording. Suggested replacement to match the corrected JSDoc:

Default to .vite when neither a package.json nor a node_modules directory is detected.

No worries if you'd rather keep this PR scoped to the build-caching clarification — just flagging it since it's the same paragraph. Happy to open a separate small PR if you prefer.

@sapphi-red sapphi-red added the bot: likely Likely a bot, LLM, or agent. Automatically comments and closes the issue or PR label Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

The PR has been manually labeled as likely to be created by a bot, LLM, or agent, and will be automatically closed. This may be because the PR contains LLM-generated descriptions, does not follow the PR template, is overly verbose, or does not contain any fruitful interaction, which harms the review process. Please read our AI policy for more information.

If you believe this is a mistake, please reply to this comment and we will review it.

@github-actions github-actions Bot closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot: likely Likely a bot, LLM, or agent. Automatically comments and closes the issue or PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unclear Documentation: Production vs Development Caching Behavior

3 participants