Skip to content

bug: File watcher sometimes does not trigger rebuild #6190

@hettiger

Description

@hettiger

Prerequisites

Stencil Version

4.27.2

Current Behavior

The file watcher sometimes fails to trigger a rebuild:

Image

This is caused by the "Back up files before saving" option in my editor.
When this option is disabled the file watcher works just fine.
However, the "Back up files before saving" option is enabled per default and Stencil should be able to handle this.

The above demo was recorded on a clean install of Stencil. It should be fairly simple to reproduce the issue as long you're using "Back up files before saving". (I don't know if it's just PHPStorm or other editors as well.)

Expected Behavior

I expect the file watcher to pick up changes reliably and trigger rebuilds accordingly with a debounce behavior.

System Info

macOS 15.3.1

PhpStorm 2024.3.4


npx stencil info

      System: node 20.14.0
    Platform: darwin (24.3.0)
   CPU Model: Apple M4 Max (16 cpus)
    Compiler: /Users/hettiger/Developer/experiments/stencil-watcher-reproduction/node_modules/@stencil/core/compiler/stencil.js
       Build: 1741029559
     Stencil: 4.27.2 🌱
  TypeScript: 5.5.4
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.1

Steps to Reproduce

  1. Create a new Stencil components project
  2. Run stencil build --watch --verbose
  3. Make sure "Back up files before saving" option or similar option in your editor is enabled
  4. Repeatedly make changes to e.g. src/components/my-component/my-component.css and hit save

Code Reproduction URL

Just install a clean Stencil project and follow steps to reproduce

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions