const path = require("path");
const fs = require("fs");
const { app } = require("electron");

// Loader entrypoint:
// - In dev: run the original source (electron/main-src.js)
// - In packaged/prod: run the bundled/minified output (dist-electron/main.cjs)

const distMain = path.join(__dirname, "..", "dist-electron", "main.cjs");
const useDist = app.isPackaged && fs.existsSync(distMain);

require(useDist ? distMain : "./main-src");
