fix(electron): app loads

This commit is contained in:
Matthew Raymer
2025-05-29 07:24:20 +00:00
parent 2c5c15108a
commit 1d5e062c76
3 changed files with 47 additions and 19 deletions
+17
View File
@@ -47,4 +47,21 @@ indexContent = indexContent.replace(
// Write the modified index.html to dist-electron/www
fs.writeFileSync(finalIndexPath, indexContent);
// Copy preload script to resources
const preloadSrc = path.join(electronDistPath, "preload.js");
const preloadDest = path.join(electronDistPath, "resources", "preload.js");
// Ensure resources directory exists
const resourcesDir = path.join(electronDistPath, "resources");
if (!fs.existsSync(resourcesDir)) {
fs.mkdirSync(resourcesDir, { recursive: true });
}
if (fs.existsSync(preloadSrc)) {
fs.copyFileSync(preloadSrc, preloadDest);
console.log("Preload script copied to resources directory");
} else {
console.error("Preload script not found at:", preloadSrc);
}
console.log("Electron index.html copied and patched for Electron context.");