fix(desktop): emit preload as .cjs so it loads under --no-sandbox (#47691)

This commit is contained in:
Luke Parker
2026-09-07 09:14:38 +10:00
committed by GitHub
Unverified
parent 13286e883e
commit 873d437c12
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -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",
},
},
},
+1 -1
View File
@@ -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)