// generate stub index.html files for dev entry import { execSync } from 'node:child_process' import fs from 'fs-extra' import chokidar from 'chokidar' import { isDev, log, port, r } from './utils' /** * Stub index.html to use Vite in development */ async function stubIndexHtml() { const views = [ 'options', 'popup', 'background', ] for (const view of views) { await fs.ensureDir(r(`extension/dist/${view}`)) let data = await fs.readFile(r(`src/${view}/index.html`), 'utf-8') data = data .replace('"./main.ts"', `"http://localhost:${port}/${view}/main.ts"`) .replace('
', '