Before adding configuration, identify whether the delay is in the dev server or the production build. They use different processing paths, so one change may not improve both. Record the Node.js and Vite versions, lockfile, and build command, then measure several runs in the same environment.
Diagnose the dev server
Measure startup, first page load, and reload after a code change separately. Dependency pre-bundling primarily affects development. When changing its settings, use browser developer tools or Vite debug logs to identify the package or transform involved, and change one thing at a time.
optimizeDeps.exclude is not a general-purpose speed switch. Excluding a dependency from pre-bundling can require extra transforms or requests and make the result slower. Consider include or exclude only for a reproducible case, such as a linked local package, and compare before and after.
Diagnose production builds
Dev server settings alone do not make a production build faster. If a build is slow, use logs and measurements to find the time spent in plugins, large dependencies, source maps, compressed-size reporting, or another specific step. Dynamic imports can reduce the amount loaded initially, but do not guarantee a shorter build or less total data transfer.
Current Vite build configuration uses Rolldown options. Do not copy older manualChunks examples without checking the official configuration for your Vite version. Excessive chunking can increase requests, complicate cache invalidation, and make the build harder to maintain.
Verify every change
Run the same command several times before and after a change, distinguishing cold and cached runs. Check output size, warnings, and application behavior as well as speed. Values prefixed with VITE_ may be embedded in client-side output, so never put passwords or private keys in them.
See the official Vite performance guide , dependency pre-bundling guide , and build options . The most reliable optimization is to target a step that measurements show is actually slow.

