Skip to content

Commit c1aec45

Browse files
committed
fix(desktop): preload must be CJS when sandbox:true (Electron limitation)
Root cause: 'Renderer is not connected to the main process' was happening because the preload script never executed. Electron's sandbox mode requires preload scripts in CommonJS format — ESM (.mjs) preload + sandbox:true is explicitly unsupported (see https://www.electronjs.org/docs/latest/tutorial/esm). Fix: - electron.vite.config: pin preload output to format:'cjs', entryFileNames:'index.js' - main/index.ts: load 'index.js' (revert the earlier .mjs change) Verified: window.codesign is now defined, custom base URL field can validate against proxy endpoints (e.g. https://www.duckcoding.ai). Signed-off-by: hqhq1025 <1506751656@qq.com>
1 parent b41da76 commit c1aec45

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

apps/desktop/electron.vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default defineConfig({
1717
outDir: 'out/preload',
1818
rollupOptions: {
1919
input: { index: resolve(__dirname, 'src/preload/index.ts') },
20+
output: { format: 'cjs', entryFileNames: 'index.js' },
2021
},
2122
},
2223
},

0 commit comments

Comments
 (0)