Skip to content

Server Watch additional files #14570

@djibarian

Description

@djibarian

Description

Currently server.watch option allows passing options to chokidar. Docs state that the glob can be negated for a node_module to be included, but it doesn't seem to be working for other files which were not previously excluded.

For example, I want to cause a plugin to be called whenever a file /config.json is changed, because that plugin generates an in-memory new json which the app consumes. Ideally that would trigger a reload, like when modifying vite.config.ts.

Trying the following doesn't work, and because the included files are not part of the chokidar options, it looks that there is no way to watch for additional files:

server: {
  watch: {
    ignored: ['!/config.json']
  }
}

Suggested solution

Make the previous negated ignored globs functional or add a new include options to server.watch.

Alternative

No response

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions