Skip to content

Expose chokidar watch options in wxt.config.ts (e.g. for polling in Docker/devcontainer) #2342

@majianchuan

Description

@majianchuan

Feature Request

Summary

Add support for configuring chokidar watch options (e.g. usePolling, interval)
via wxt.config.ts, so users can control file watching behavior without relying on
environment variables.

Motivation

When developing inside Docker containers or VS Code devcontainers, the file system
does not emit native OS events. This means WXT's file watcher (backed by chokidar)
never detects changes, effectively breaking wxt dev.

The only current workaround is to set chokidar's environment variables before running:

CHOKIDAR_USEPOLLING=1 wxt dev

While this works, it's undocumented, easy to forget, and harder to share across a
team (e.g. in package.json scripts it requires platform-specific handling or
cross-env).

Proposed API

Expose a watchOptions field in InlineConfig that passes options directly to
chokidar:

// wxt.config.ts
export default defineConfig({
  watchOptions: {
    usePolling: true,
    interval: 1000,
  },
});

Alternatives Considered

  • CHOKIDAR_USEPOLLING=1 env var — works but is not part of the config file,
    harder to document and share
  • vite.server.watch — excluded by WXT
  • vite.build.watch — explicitly blocked by WXT with an error

Use Cases

  • Docker / devcontainer development
  • WSL1 / WSL2 (cross-filesystem mounts like /mnt/c/...)
  • NFS or other network file systems
  • Any environment where inotify / fsevents are unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions