Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watch build generates wrong build manifest #19360

Closed
7 tasks done
hi-ogawa opened this issue Feb 5, 2025 · 0 comments · Fixed by #19361
Closed
7 tasks done

watch build generates wrong build manifest #19360

hi-ogawa opened this issue Feb 5, 2025 · 0 comments · Fixed by #19361

Comments

@hi-ogawa
Copy link
Collaborator

hi-ogawa commented Feb 5, 2025

Describe the bug

It looks like manifest plugin doesn't reset properly between watch rebuild. What's the intent of not resetting this.manifest too? The issue reproduces on Vite 5 as well.

export function manifestPlugin(): Plugin {
const getState = usePerEnvironmentState(() => {
return {
manifest: {} as Manifest,
outputCount: 0,
reset() {
this.outputCount = 0
},
}
})

(For the context, I was investigating a similar issue on double rsc environment builds with rolldown-vite hi-ogawa/vite-environment-examples#154. Though my issue somehow doesn't show up on current vite, I just found a similar issue with current vite's watch build.)

Reproduction

https://stackblitz.com/github/hi-ogawa/reproductions/tree/main/rolldown-vite-watch-build-manifest?file=src%2Fmain.js

Steps to reproduce

  • open stackblitz and run vite build --watch
  • see dist/.vite/manifest.json includes src/dep.js
  • edit src/main.js to remove import("./dep.js")
  • see dist/.vite/manifest.json still includes src/dep.js
$ pnpm build --watch
vite v6.0.11 building for production...

watching for file changes...

--- 1st build ---
build started...
✓ 5 modules transformed.
dist/.vite/manifest.json       0.31 kB │ gzip: 0.18 kB
dist/index.html                0.32 kB │ gzip: 0.23 kB
dist/assets/dep-D1M531Dn.js    0.02 kB │ gzip: 0.04 kB
dist/assets/index-6lgMnd3v.js  3.35 kB │ gzip: 1.25 kB
built in 61ms.

--- 2nd build ---
build started...
✓ 1 modules transformed.
dist/.vite/manifest.json       0.26 kB │ gzip: 0.16 kB
dist/index.html                0.32 kB │ gzip: 0.23 kB
dist/assets/index-X0jGllOl.js  1.29 kB │ gzip: 0.53 kB
built in 21ms.

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^6 => 6.0.11

Used Package Manager

pnpm

Logs

No response

Validations

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant