import { renderToString } from 'react-dom/server'; import { RemixServer } from '@remix-run/react'; import { createReadStream, createWriteStream } from 'fs'; import { mkdir } from 'fs/promises'; import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; const __dirname = dirname(fileURLToPath(import.meta.url)); const projectRoot = resolve(__dirname, '..'); async function generateHTML() { try { const distDir = resolve(projectRoot, 'dist'); await mkdir(distDir, { recursive: true }); const html = `