super-productivity/electron/scripts/bundle-preload.js
Johannes Millan a118f65d54 refactor(electron): bundle preload script with esbuild to support sandbox mode
Bundle preload.ts into a single file so all local imports (e.g.
ipc-events.const) are inlined at build time. This allows removing
sandbox: false since the bundled preload only requires the built-in
electron module, which is allowed in sandboxed preloads.
2026-03-22 19:38:21 +01:00

15 lines
381 B
JavaScript

#!/usr/bin/env node
const { build } = require('esbuild');
const path = require('path');
build({
entryPoints: [path.join(__dirname, '..', 'preload.ts')],
bundle: true,
outfile: path.join(__dirname, '..', 'preload.js'),
platform: 'node',
target: 'es2022',
format: 'cjs',
external: ['electron'],
sourcemap: false,
logLevel: 'info',
}).catch(() => process.exit(1));