| 76 | }) |
| 77 | |
| 78 | function createWindow() { |
| 79 | const preloadPath = path.join(__dirname, 'preload.cjs') |
| 80 | |
| 81 | const win = new BrowserWindow({ |
| 82 | width: 800, |
| 83 | height: 600, |
| 84 | webPreferences: { |
| 85 | contextIsolation: true, |
| 86 | nodeIntegration: false, |
| 87 | preload: preloadPath, |
| 88 | }, |
| 89 | }) |
| 90 | |
| 91 | // Dev: load Vite dev server. Prod: load built files. |
| 92 | if (process.env.NODE_ENV !== 'production') { |
| 93 | win.loadURL('http://localhost:5173') |
| 94 | } else { |
| 95 | win.loadFile(path.join(__dirname, '..', 'dist', 'index.html')) |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | app.whenReady().then(() => { |
| 100 | // Add a menu with "New Window" so cross-window sync can be tested. |