const fs = require('fs') const path = require('path') const compiledMainPath = path.join(__dirname, 'dist', 'main', 'index.js') const legacyMainPath = path.join(__dirname, 'index.legacy.js') if(fs.existsSync(compiledMainPath)){ try { require(compiledMainPath) } catch (error) { console.warn('[launcher] compiled TypeScript main process failed, falling back to legacy entry.', error) require(legacyMainPath) } } else { require(legacyMainPath) }