mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-17 05:26:47 +03:00
fix(desktop): emit preload as .cjs so it loads under --no-sandbox (#47691)
This commit is contained in:
committed by
GitHub
Unverified
parent
13286e883e
commit
873d437c12
@@ -78,7 +78,10 @@ const require = __cjs_mod__.createRequire(import.meta.url);
|
||||
input: { index: "src/preload/index.ts" },
|
||||
output: {
|
||||
format: "cjs",
|
||||
entryFileNames: "[name].js",
|
||||
// The package is "type": "module". Under --no-sandbox Electron loads the preload
|
||||
// through Node's module loader, which treats a .js file as ESM and fails on
|
||||
// require("electron"). The sandboxed path ignores the extension.
|
||||
entryFileNames: "[name].cjs",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@ export const resolve = Effect.gen(function* () {
|
||||
const root = path.dirname(yield* path.fromFileUrl(new URL(import.meta.url)))
|
||||
return {
|
||||
developmentResourcesRoot: path.join(root, "../../resources"),
|
||||
preloadPath: path.join(root, "../preload/index.js"),
|
||||
preloadPath: path.join(root, "../preload/index.cjs"),
|
||||
rendererRoot: path.join(root, "../renderer"),
|
||||
} satisfies Resolved
|
||||
}).pipe(Effect.orDie)
|
||||
|
||||
Reference in New Issue
Block a user