wxt-dev/wxt

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

已關閉

#2,342 建立於 2026年5月9日

 (1 則留言) (0 個反應) (0 位負責人)TypeScript (511 個分叉)user submission
contribution welcomegood first issue

倉庫指標

星標
 (9,861 顆星)
PR 合併指標
 (平均合併 11天 22小時) (30 天內合併 51 個 PR)

描述

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

貢獻者指南