vitejs / vite

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

After migrating from vite 4 to 5, the code generated in the production environment is different #16065

Closed ilaoniu closed 2 weeks ago

ilaoniu commented 7 months ago

Describe the bug

After migrating from vite 4 to 5, the code generated in the production environment is different, but there is no problem in the development environment.

Under normal circumstances, the page will not scroll when dragging the box. Currently, the page scrolls when the box is dragged.

By comparing the codes generated in the production environments of vite 5 and 4, we found that vite 5 is missing the "passive" code block.

v5-vs-v4-1 v5-vs-v4-2 touch-end-1 touch-end-2

vite 5 https://stackblitz.com/edit/vitejs-vite-nlrxvr?file=src%2FApp.vue

vite 4 https://stackblitz.com/edit/vitejs-vite-2zqnm1?file=src%2FApp.vue

Reproduction

https://stackblitz.com/edit/vitejs-vite-nlrxvr?file=src%2FApp.vue

Steps to reproduce

npm run build

This sample code only runs properly on mobile devices.

System Info

System:
    OS: macOS 14.3.1
    CPU: (8) x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
    Memory: 144.00 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.1.0 - ~/Library/pnpm/node
    Yarn: 1.22.21 - ~/Library/pnpm/yarn
    npm: 10.2.0 - ~/Library/pnpm/npm
    pnpm: 8.10.0 - ~/Library/pnpm/pnpm
  Browsers:
    Chrome: 122.0.6261.94
    Safari: 17.3.1
  npmPackages:
    @vitejs/plugin-vue: ^5.0.4 => 5.0.4
    vite: ^5.1.4 => 5.1.4

Used Package Manager

npm

Logs

No response

Validations

stackblitz[bot] commented 7 months ago

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

sapphi-red commented 7 months ago

This seems to be a bug in rollup (https://github.com/rollup/rollup/issues/5408).

sapphi-red commented 2 weeks ago

Closing as this is fixed by rollup 4.22.0.