Skip to content

Optimizer behaviour change leading to errors #20867

@jamesopstad

Description

@jamesopstad

Describe the bug

The changes in this PR have created issues for users of @cloudflare/vite-plugin. Upgrading to vite@^7.1.3 is leading to frequent occurrences of Error: There is a new version of the pre-bundle for ... errors.

Reproduction

https://github.com/jamesopstad/optimize-deps-repro

Steps to reproduce

Run pnpm i followed by pnpm dev. Every browser refresh will trigger the error.

Note that I have patched TanStack Start so that dependencies are not discovered ahead of time. This makes the issue more obvious. If the Vite version is switch from 7.1.3 to 7.1.2 then an error occurs on the first load but not subsequent loads. This is the expected behaviour.

System Info

System:
    OS: macOS 15.6.1
    CPU: (12) arm64 Apple M3 Pro
    Memory: 1.12 GB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.2.0 - ~/.nvm/versions/node/v24.2.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v24.2.0/bin/yarn
    npm: 11.3.0 - ~/.nvm/versions/node/v24.2.0/bin/npm
    pnpm: 10.15.1 - ~/.nvm/versions/node/v24.2.0/bin/pnpm
  Browsers:
    Chrome: 140.0.7339.208
    Safari: 18.6

Used Package Manager

pnpm

Logs

Error: There is a new version of the pre-bundle for ...

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions