vite-plugin-child-process
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

vite-plugin-child-process

Vite plugin to run command when file change. Useful when script use local binary or have stateful behavior like websocket.

// vite.config.js
import { child_process } from 'vite-plugin-child-process'

export default {
  plugins: [
    child_process({
      name: "my-backend-server",
      command: ["node", "./backend_server.js"],
      watch: [/src/, /controller/]
    })
  ]
};

Parameters

export interface VitePluginChildProcess {
  /** command name for prefix log ouput @default "untitle" */
  name?: string;
  /** command to run */
  command: string[];
  /** @default 10ms */
  delay?: number;
  /** vite watch file change */
  watch: (RegExp | string)[];
  /** @default true */
  log_enable?: boolean;
}

Environment

this plugin use debug module to log, specify environment DEBUG= will show stdout/stderr of command.

DEBUG=vite:child-process:*

Footnote

PR and issue always wellcome

Package Sidebar

Install

npm i vite-plugin-child-process

Weekly Downloads

2

Version

1.0.6

License

ISC

Unpacked Size

17.8 kB

Total Files

7

Last publish

Collaborators

  • krist7599555