Skip to content

Can't ignore relative paths #1436

@bdoms

Description

@bdoms

Absolute and regex (**) paths included in the config options are properly ignored, but relative paths never work. e.g.:

ignored: ['build', 'tests'']

Won't ignore those folders and will continue to watch them.

The issue is that relative paths are combined with the cwd but the cwd defaults to an empty string. Using the empty string means relative paths will never work, unless you happen to be in the root directory. You can see this in several places in index.ts, such as the normalizeIgnored function: https://github.com/paulmillr/chokidar/blob/main/src/index.ts#L182

Possible solution: use process.cwd() as the default instead. I can create a pull request if this is acceptable.

This is happening on all platforms with the most recent published version, 4.0.3, though this issue has existed since at least October, 2023: https://stackoverflow.com/questions/77355876/vite-not-respecting-server-watch-ignored-option-laravel/79724226

I would hazard to guess that there are a lot of projects out there thinking they're ignoring relative folders, but actually aren't because of this bug. They just won't know it until they hit the file watcher limit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions