1// Auto-install playwright chromium browser if missing2import { chromium } from 'playwright'3import { existsSync } from 'fs'4import { execSync } from 'child_process'6let installed = false8export const ensurePlaywrightChromium = () => {9 if (installed) return10 const binPath = chromium.executablePath()11 if (existsSync(binPath)) {12 installed = true13 return14 }15 console.log('Installing playwright chromium browser...')16 execSync('npx playwright install chromium', {stdio: 'inherit'})17 installed = true18}