const path = require('path'); const fs = require('fs-extra'); async function main() { try { console.log('Starting electron build process...'); // Create dist directory if it doesn't exist const distElectronDir = path.resolve(__dirname, '../dist-electron'); await fs.ensureDir(distElectronDir); // Copy web files const wwwDir = path.join(distElectronDir, 'www'); await fs.ensureDir(wwwDir); await fs.copy('dist', wwwDir); // Copy and fix index.html const indexPath = path.join(wwwDir, 'index.html'); let indexContent = await fs.readFile(indexPath, 'utf8'); // More comprehensive path fixing indexContent = indexContent // Fix absolute paths to be relative .replace(/src="\//g, 'src="\./') .replace(/href="\//g, 'href="\./') // Fix modulepreload paths .replace(/]*rel="modulepreload"[^>]*href="\/assets\//g, ']*href="\.\/assets\//g, ']*href="\/assets\//g, ']*href="\.\/assets\//g, '