Vite plugin that runs shell commands on file changes or server startup. v0.9.0 (released 2025) drops CommonJS support and migrates to bun/tsdown. Key plugin options: silent, skipDts, input. Runner options include pattern (minimatch), condition (function), debounce, startup, build, onFileChanged. Uses execa for shell commands. Maintained by Enzo Innocenzi, updates ~yearly.
npm install vite-plugin-runVerified import paths — ran on the pinned version, not inferred.
Basic Vite plugin setup to run eslint on TypeScript file changes with 100ms debounce.
Use ES module imports with 'import { run } from ...' instead of 'require()'.Remove any usage of 'throttle' from runner options and use 'debounce' (milliseconds).
Ensure vite version meets peer dependency requirements (vite ^8.0.8 for v0.9.0).
Use 'condition' or 'pattern' to react to file changes instead.
Use narrow minimatch patterns or add a 'condition' function for fine-grained control.
Use import: import { run } from 'vite-plugin-run'Run 'npm install vite-plugin-run' and ensure vite 8.x is installed.
Use named import: import { run } from 'vite-plugin-run'Switch project to ESM ("type": "module" in package.json) or use dynamic import: const { run } = await import('vite-plugin-run')