Skip to content

Watcher does not rebuild when file in subdirectory is written atomically #23227

Description

@WhyNotHugo

Describe the bug

When I edit file src/composables/usePhotoStore.ts, npm exec -- vite build --watch --mode development doesn't rebuild.

If I edit src/main.ts, a rebuild is triggerd.

I narrowed this down to a minimal reproducer. This only happens when atomically writing (e.g.: write to new file, then replace) a file in a subdirectory.

Reproduction

https://paste.sr.ht/~whynothugo/52c200f2edc65bee7da6893134afa1cc7e8ce873

Steps to reproduce

Use reproducer above or:

  • Run npm exec -- vite build --watch
  • Edit file in nested directory with vim (which does atomic writes)

System Info

# npx envinfo --system --npmPackages '{vite,@vitejs/*,rollup,rolldown}' --binaries --browsers
Need to install the following packages:
envinfo@7.21.0
Ok to proceed? (y) y

  System:
    OS: Linux 7.1 Alpine Linux
    CPU: (24) x64 13th Gen Intel(R) Core(TM) i7-13700K
    Memory: 22.13 GB / 62.54 GB
    Container: Yes
    Shell: Unknown - /bin/sh
  Binaries:
    Node: 24.16.0 - /usr/local/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 11.13.0 - /usr/local/bin/npm
  npmPackages:
    @vitejs/plugin-vue: ^6.0.8 => 6.0.8 
    vite: ^8.2.1 => 8.2.1

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug: upstreamBug in a dependency of Vitefeat: buildp3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions