Registry / devops / vite-plugin-run

vite-plugin-run

JSON →
library0.9.0jsnpmunverified

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-run
INSTALL
IMPORT
SIG · VITE-PLUGIN-RUN
V
vite-plugin-run
devopsjavascriptv0.9.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

run
✓ import { run } from 'vite-plugin-run'
✗ const { run } = require('vite-plugin-run')
v0.9.0 is ESM-only; use import syntax. CommonJS require will fail.
RunOptions
✓ import type { RunOptions } from 'vite-plugin-run'
✗ import { RunOptions } from 'vite-plugin-run'
TypeScript users should use 'import type' for type-only imports. Available since v0.4.0.
Plugin
✓ import { run } from 'vite-plugin-run'
✗ import vitePluginRun from 'vite-plugin-run'
The plugin has no default export; always use named import 'run'.

Basic Vite plugin setup to run eslint on TypeScript file changes with 100ms debounce.

import { defineConfig } from 'vite'; import { run } from 'vite-plugin-run'; export default defineConfig({ plugins: [ run([ { name: 'lint', run: ['eslint', '--fix'], pattern: 'src/**/*.ts', debounce: 100, }, ]), ], });
Debug
Known issues
breakingv0.9.0 removed CJS support; package is ESM-only.
fix
Use ES module imports with 'import { run } from ...' instead of 'require()'.
affects: >=0.9.0
breakingv0.8.0 dropped 'throttle' option; only 'debounce' is supported.
fix
Remove any usage of 'throttle' from runner options and use 'debounce' (milliseconds).
affects: >=0.8.0
breakingv0.8.0 upgraded dependencies, may require Vite 4.4+.
fix
Ensure vite version meets peer dependency requirements (vite ^8.0.8 for v0.9.0).
affects: >=0.8.0 <0.9.0
deprecated'onFileChanged' callback is deprecated; plan to remove in v1.0.
fix
Use 'condition' or 'pattern' to react to file changes instead.
affects: >=0.4.0
gotchaIf 'pattern' is specified without 'condition', the command runs for any file matching pattern. Ensure patterns are specific enough to avoid unnecessary command execution.
fix
Use narrow minimatch patterns or add a 'condition' function for fine-grained control.
affects: >=0.1.0
Errors
Common errors & fixes
const { run } = require('vite-plugin-run')
CJS require() used with ESM-only module (v0.9.0+).
fix
Use import: import { run } from 'vite-plugin-run'
Cannot find module 'vite-plugin-run'
Package not installed or vite version incompatible (requires vite ^8.0.8).
fix
Run 'npm install vite-plugin-run' and ensure vite 8.x is installed.
TypeError: run is not a function
Default import used incorrectly (e.g., import vitePluginRun from 'vite-plugin-run').
fix
Use named import: import { run } from 'vite-plugin-run'
ERR_REQUIRE_ESM: require() of ES Module
Trying to require an ESM-only package in a CommonJS context.
fix
Switch project to ESM ("type": "module" in package.json) or use dynamic import: const { run } = await import('vite-plugin-run')
Upgrade
Version history
0.9.0latest on npm
Audit
Dependencies
viterequiredpeer dependency, requires Vite 8+
Agent activity
7 hits · last 30 days
node
6
Resources
vite-plugin-run — npm install vite-plugin-run · libregistry