From d65aa40afc524a0eb920476d41a6a5bf96a41425 Mon Sep 17 00:00:00 2001 From: lilianakatrina684-a11y Date: Sun, 22 Mar 2026 00:29:13 +0800 Subject: [PATCH] docs: Clarify production build caching --- docs/config/shared-options.md | 2 +- docs/guide/build.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/config/shared-options.md b/docs/config/shared-options.md index b5e4a5b8a2073e..14934090bc4130 100644 --- a/docs/config/shared-options.md +++ b/docs/config/shared-options.md @@ -87,7 +87,7 @@ See [The `public` Directory](/guide/assets#the-public-directory) for more detail - **Type:** `string` - **Default:** `"node_modules/.vite"` -Directory to save cache files. Files in this directory are pre-bundled deps or some other cache files generated by vite, which can improve the performance. You can use `--force` flag or manually delete the directory to regenerate the cache files. The value can be either an absolute file system path or a path relative to project root. Default to `.vite` when no `package.json` is detected. +Directory to save cache files. Files in this directory are pre-bundled deps and some other cache files generated by Vite, mostly to improve dev server performance. This directory isn't used as a persistent cache for production builds, so running `vite build` repeatedly will still rebuild the app from source. You can use `--force` flag or manually delete the directory to regenerate the cache files. The value can be either an absolute file system path or a path relative to project root. Default to `.vite` when no `package.json` is detected. ## resolve.alias diff --git a/docs/guide/build.md b/docs/guide/build.md index 2c01e1401a0fc7..0e247a37c07ca0 100644 --- a/docs/guide/build.md +++ b/docs/guide/build.md @@ -2,6 +2,8 @@ When it is time to deploy your app for production, simply run the `vite build` command. By default, it uses `/index.html` as the build entry point, and produces an application bundle that is suitable to be served over a static hosting service. Check out the [Deploying a Static Site](./static-deploy) for guides about popular services. +Vite's dependency pre-bundling and `cacheDir` file-system cache are dev-focused optimizations. Production builds don't currently reuse `cacheDir` as a persistent cache across separate `vite build` runs, so repeated builds are expected to transform and bundle the app again. + Watch an interactive lesson on Scrimba ## Browser Compatibility