import { readFile, rm, writeFile } from 'node:fs/promises'; import path from 'node:path'; const output = path.resolve(process.argv[2] ?? 'offline-dist'); const htmlPath = path.join(output, 'index.html'); const scriptPath = path.join(output, 'assets', 'app.js'); const stylePath = path.join(output, 'assets', 'app.css'); const packageJson = JSON.parse(await readFile(path.resolve('package.json'), 'utf8')); const isPagesBuild = path.basename(output) === 'pages-dist'; let html = await readFile(htmlPath, 'utf8'); html = html.replace(/