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 = ` Your App
`; const indexPath = resolve(distDir, 'index.html'); const writer = createWriteStream(indexPath); writer.write(html); writer.end(); console.log('HTML file generated successfully at:', indexPath); } catch (error) { console.error('Error generating HTML:', error); process.exit(1); } } generateHTML();