百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
V

vite-plugin-run

> 编程语言
开源

在 Vite 启动或文件发生变化时运行命令

100 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

在 Vite 启动或文件发生变化时运行命令

Runner plugin for Vite

	A plugin for running commands when files change or when Vite starts.

 

Usage

Install vite-plugin-run and add it to your Vite configuration:

typescript
import { run } from 'vite-plugin-run'

export default defineConfig({
	plugins: [
		laravel(),
		vue(),
		run([
			{
				name: 'typescript transform',
				run: ['php', 'artisan', 'typescript:transform'],
				pattern: ['app/**/*Data.php', 'app/**/Enums/**/*.php'],
			},
			{
				name: 'build routes',
				run: ['php', 'artisan', 'routes:generate'],
				condition: (file) => file.includes('/routes/'),
			},
		]),
	],
})

You can either use a pattern or a condition to specify how the files changes should be detected.

When a file in your project changes, its path will be given as an argument to condition. If the function returns true, a shell command described by run will be executed.

 

Plugin options

Option Type Description Default
silent bool Whether to hide the commands output in the console true
skipDts bool Whether to skip HMR reloads when a .d.ts file changes true
input Runner[] List of runners []

Optionally, you can directly pass a runner or a list of runner to the plugin options.

 

Runner options

Option Type Description Default
startup bool Whether the command should run when Vite starts true
build bool Whether the command should run when Vite builds true
name string An identifier for the runner, used in logs
condition () => boolean A function that should return true for a file change to execute the runner
pattern string or string[] A minimatch pattern which files must match
run () => string[] or string[] A command executed when a file changed and the condition matches
onFileChanged () =>void A callback executed when a file changed and the condition matches
debounce number Debounce delay before running the file-change handler and command 50
·




Built with ❤︎ by Enzo Innocenzi

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScript

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言