New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

vite-plugin-command

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vite-plugin-command

Vite plugin to run custom commands on file changes

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

Vite Command Runner

A Vite plugin that runs custom shell commands on file changes.

Installation

You can install the package via npm:

npm i -D vite-plugin-command

Usage

Import the package from vite.config.js and configure it.

import { defineConfig } from "vite"
import { command } from "vite-plugin-command"

export default defineConfig({
  plugins: [ 
    command({
      pattern: "routes/**/*.php",
      run: "php artisan ziggy:generate",
    }),
  ],
})

You can also run multiple commands by passing an array of objects.

export default defineConfig({
  plugins: [ 
    command([
      {
        pattern: "routes/**/*.php",
        run: "php artisan ziggy:generate",
      },
      {
        pattern: "app/{Data,Enums}/**/*.php",
        run: "php artisan typescript:transform",
      },
    ]),
  ],
})

Once a tracked file changes, the plugin will execute the specified command.

Plugin options

nametypedescriptiondefault
patternstring or string[]Tracked files paths (minimatch pattern)
runstringThe command to be executed
silentbooleanHide the command output in the consolefalse
throttlenumberDelay before the command can be re-executed (in milliseconds)500
startupbooleanRun the command when Vite startstrue
customOutputstring or (output) => stringDisplay a custom output in the console after command ran (when set, the command output will be hidden)

License

The MIT License (MIT). Please see License File for more information.

Keywords

vite

FAQs

Package last updated on 23 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts