Skip to content

Commit 6829891

Browse files
committed
Move electron-serve to electron dist as it is needed for hosting static pages as part of electron
1 parent cd1939d commit 6829891

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

forge.config.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import type { ForgeConfig } from "@electron-forge/shared-types";
2+
import path from "path";
3+
import fs from "fs-extra";
24

35
const config: ForgeConfig = {
46
outDir: "out-desktop",
@@ -15,9 +17,19 @@ const config: ForgeConfig = {
1517
} else if (path.match(/desktop/)) {
1618
return false;
1719
}
18-
1920
return true;
2021
},
22+
extraResource: "node_modules/electron-serve",
23+
afterCopyExtraResources: [
24+
(copyPath, electronVersion, platform, arch, done) => {
25+
// move node_modules/electron-serve to the app directory
26+
fs.moveSync(
27+
path.join(copyPath, "resources/electron-serve"),
28+
path.join(copyPath, "resources/app/node_modules/electron-serve"),
29+
);
30+
done();
31+
},
32+
],
2133
},
2234
};
2335

0 commit comments

Comments
 (0)