diff --git a/packages/vite/src/node/cli.ts b/packages/vite/src/node/cli.ts index 58aa57db02a3eb..27981ac4004f92 100644 --- a/packages/vite/src/node/cli.ts +++ b/packages/vite/src/node/cli.ts @@ -169,7 +169,9 @@ cli '--force', `[boolean] force the optimizer to ignore the cache and re-bundle`, ) - .option('--watchStdin', `[boolean] watch stdin and exit on EOF`) + .option('--watchStdin', `[boolean] watch stdin and exit on EOF`, { + default: !process.stdin.isTTY, + }) .action(async (root: string, options: ServerOptions & GlobalCLIOptions) => { filterDuplicateOptions(options) // output structure is preserved even after bundling so require() @@ -365,7 +367,9 @@ cli .option('--strictPort', `[boolean] exit if specified port is already in use`) .option('--open [path]', `[boolean | string] open browser on startup`) .option('--outDir ', `[string] output directory (default: dist)`) - .option('--watchStdin', `[boolean] watch stdin and exit on EOF`) + .option('--watchStdin', `[boolean] watch stdin and exit on EOF`, { + default: !process.stdin.isTTY, + }) .action( async ( root: string,