vitejs / vite

Next generation frontend tooling. It's fast!
http://vite.dev
MIT License
69.04k stars 6.24k forks source link

Vite `--watch` mode break after first change (Vite v.5.X) #16694

Closed Paolino95 closed 6 months ago

Paolino95 commented 6 months ago

Describe the bug

Good morning,

I report the fact that Vite build, in watch mode, builds and remains correctly active in the first build, but following the first change the build is re-run and terminated, without remaining active waiting for further changes.

The problem seems different from other old (and solved) issues, such as https://github.com/vitejs/vite/issues/12852 or https://github.com/vitejs/vite/issues/12791;

In fact, by doing some testing, I noticed that in my specific case I find the issue using TypeScript, also going through the generation of type files through https://github.com/qmhc/vite-plugin-dts.

Writing code in JS I noticed that I don't have this problem. Now I can't figure out if this problem is related to TS or to the plugin itself, or either.

Reproduction

https://stackblitz.com/edit/vitejs-vite-czcsmo?file=src%2Fvite-env.d.ts

Steps to reproduce

Run npm install, then npm build:lib:watch.

Change something in lib/main.ts.

You will see that the build will terminate, without staying in watch mode.

System Info

System:
    OS: macOS 14.4.1
    CPU: (8) arm64 Apple M2
    Memory: 148.11 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.2 - ~/.nvm/versions/node/v18.20.2/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v18.20.2/bin/yarn
    npm: 10.5.2 - ~/.nvm/versions/node/v18.20.2/bin/npm
  Browsers:
    Brave Browser: 124.1.65.126
    Safari: 17.4.1

Used Package Manager

npm

Logs

No response

Validations

stackblitz[bot] commented 6 months ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

sapphi-red commented 6 months ago

I think it's happening because rollup-plugin-sourcemaps is not compatible with rollup 4.0.0+, specifically this change.

Closing as this is not a bug in Vite.