Registry / devops / vite-plugin-watch-and-run

vite-plugin-watch-and-run

JSON →
library1.8.0jsnpmunverified

A Vite plugin (v1.8.0) that watches specified files and runs a package.json script when changes are detected. Built on top of chokidar, it supports glob patterns, debouncing, and console output customization. Part of the KitQL ecosystem, it is actively maintained with regular releases. Unlike using chokidar directly, it integrates seamlessly into the Vite dev server lifecycle.

npm install vite-plugin-watch-and-run
INSTALL
IMPORT
SIG · VITE-PLUGIN-WATCH-
V
vite-plugin-watch-and-run
devopsjavascriptv1.8.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import watchAndRun from 'vite-plugin-watch-and-run'
const { watchAndRun } = require('vite-plugin-watch-and-run')
Default export; named import `WatchAndRun` also works but default is recommended.
WatchAndRun
import { WatchAndRun } from 'vite-plugin-watch-and-run'
import WatchAndRun from 'vite-plugin-watch-and-run'
Named export available since v1.7.0.
Params (type)
import type { Params } from 'vite-plugin-watch-and-run'
TypeScript type export for configuration.

Watches CSS files for changes and runs the build:css script.

// vite.config.js import { defineConfig } from 'vite'; import watchAndRun from 'vite-plugin-watch-and-run'; export default defineConfig({ plugins: [ watchAndRun([ { watch: 'src/**/*.css', run: 'npm run build:css', }, ]), ], });
Debug
Known issues
breakingGlob pattern handling changed: v1.8.0 uses picomatch instead of micromatch and extracts base paths for chokidar.
fix
Review glob patterns. Any glob that relied on micromatch-specific features may need adjustment.
affects: >=1.8.0
gotchaThe `delay` option (ms) is applied per run; multiple changes within the delay may coalesce but not guaranteed.
fix
Set `delay` to a value high enough to coalesce rapid changes (e.g., 500).
affects: >=1.0.0
deprecatedOption `log_on_throw_is_not_a_new_class` was removed in vite-plugin-watch-and-run@1.8.0.
fix
Remove this option from your configuration; it is no longer supported.
affects: >=1.8.0
gotchaThe plugin runs the script in the project root; ensure the script is defined in package.json scripts.
fix
Verify the script exists in your package.json under `scripts`.
affects: >=1.0.0
Errors
Common errors & fixes
Error: The plugin `vite-plugin-watch-and-run` does not provide a default export
Using `import { watchAndRun }` when the default export is needed.
fix
Use `import watchAndRun from 'vite-plugin-watch-and-run'` instead.
Module not found: Can't resolve 'vite-plugin-watch-and-run'
Missing dependency or incorrect installation.
fix
Run `npm install vite-plugin-watch-and-run --save-dev` and ensure Vite is installed.
TypeError: watchAndRun is not a function
Importing the named export incorrectly.
fix
Use default import: `import watchAndRun from 'vite-plugin-watch-and-run'`.
Upgrade
Version history
1.8.0latest on npm
Audit
Dependencies
viterequiredPeer dependency required for plugin functionality
Agent activity
3 hits · last 30 days
node
2
Amazon
1
Resources
vite-plugin-watch-and-run — npm install vite-plugin-watch-and-run · libregistry