vite-plugin-child-process
v1.0.6
Published
Vite plugin to run command when file change. Useful when script use local binary or have stateful behavior like websocket.
Downloads
53
Maintainers
Readme
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