Skip to content

Vite 7: Dependency scan error only appears on first run, then server works fine (regression from Vite 6) #20377

@oscarmarina

Description

@oscarmarina

Describe the bug

When upgrading from Vite 6 to Vite 7, I encounter this error only the first time I start the dev server:

Failed to run dependency scan. Skipping dependency pre-bundling. Error: failed to resolve rollupOptions.input value: "demo/entry.js".
  • The error only appears on the first run after upgrading Vite and running npm run dev.
  • The dev server still starts and works correctly even when the error appears.
  • After making any change to the code (triggering HMR), the server continues to function and the error does not reappear.
  • If I stop the server (Ctrl+C) and run npm run dev again, the error does not show up anymore.
  • This behavior is not present in Vite 6; there are no errors in the same setup.

Reproduction

https://stackblitz.com/edit/vitejs-vite-rwztsg7q?file=vite.config.js

Steps to reproduce

  1. Go to this URL: https://stackblitz.com/edit/vitejs-vite-rwztsg7q?file=vite.config.js
    The error appears the first time the dev server starts.
    Note: You may need to scroll up in the terminal to see the error message, as it is above the visible area.
  2. Stop the server.
  3. Run npm run dev again.
    The error does not appear anymore.
  4. Alternatively, in the StackBlitz terminal, run rm -rf node_modules && npm i and then npm run dev.
    The error appears again.

System Info

System:
    OS: macOS 15.5
    CPU: (8) arm64 Apple M3
    Memory: 1.04 GB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.9.0 - ~/.nvm/versions/node/v22.9.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v22.9.0/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v22.9.0/bin/npm
    pnpm: 9.15.4 - ~/.nvm/versions/node/v22.9.0/bin/pnpm
    bun: 1.1.34 - ~/.bun/bin/bun
  Browsers:
    Chrome: 138.0.7204.93
    Chrome Canary: 140.0.7280.0
    Edge: 138.0.3351.65
    Safari: 18.5
    Safari Technology Preview: 26.0

Used Package Manager

npm

Logs

Image

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: deps optimizerEsbuild Dependencies Optimizationhas workaroundp3-downstream-blockerBlocking the downstream ecosystem to work properly (priority)regressionThe issue only appears after a new release

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions