Skip to content

Unclear Documentation: Production vs Development Caching Behavior #19214

Description

@CodySchaaf

Documentation is

  • Missing
  • Outdated
  • Confusing
  • Not sure?

Explain in Detail

The documentation clearly explains dependency pre-bundling and caching behavior in development mode, but is unclear about what caching behavior (if any) should be expected during production builds.

Currently, we can observe that:

  • Development mode uses the .vite cache directory for dependency pre-bundling
  • Production builds appear to rebuild/transform all modules each time
  • The cacheDir config option exists but its impact on production builds is not documented

This creates uncertainty when:

  • Planning CI/CD pipelines
  • Trying to optimize build times
  • Deciding whether to pursue other optimization strategies

Your Suggestion for Changes

Add a section in the Production build documentation that explicitly describes:

  1. Expected caching behavior in production builds
  2. How caching differs between development and production
  3. Whether any caching between production builds is possible/intended
  4. If no caching is intended for production, explain the reasoning

This would help teams better understand what to expect and how to optimize their build processes.

Reproduction

No response

Steps to reproduce

  1. Create new Vite project (npm create vite@latest)
  2. Run production build: npm run build
  3. Run production build again without changes
  4. Observe that all modules are transformed again
  5. Check .vite directory - no cached artifacts from production builds

The behavior itself works, but its documentation is unclear about whether this is expected, or can be improved.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions