import { spawn } from 'node:child_process';

const child = spawn('vite', ['preview', '--host', '0.0.0.0', '--port', '3000', '--strictPort'], {
  stdio: 'inherit',
  shell: process.platform === 'win32',
  env: {
    ...process.env,
    NODE_ENV: 'production'
  }
});

child.on('exit', (code, signal) => {
  if (signal) process.kill(process.pid, signal);
  process.exit(code ?? 0);
});
