Skip to content

Commit 7adaecb

Browse files
committed
Update electron forge extract path for darwin
1 parent 3f8fe6e commit 7adaecb

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

forge.config.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import type { ForgeConfig } from "@electron-forge/shared-types";
22
import path from "path";
33
import fs from "fs-extra";
44

5-
function removeNextjsModules(exceptionList: string[], extractPath: string) {
6-
const nodeModulesPath = path.join(extractPath, "resources/app/node_modules");
7-
5+
function removeNextjsModules(exceptionList: string[], nodeModulesPath: string) {
86
fs.readdirSync(nodeModulesPath).forEach((module) => {
97
if (!exceptionList.includes(module)) {
108
fs.removeSync(path.join(nodeModulesPath, module));
@@ -37,8 +35,22 @@ const config: ForgeConfig = {
3735
// All other modules from nextjs are not needed and can be removed.
3836

3937
const electronModules = ["electron-serve"];
40-
41-
removeNextjsModules(electronModules, extractPath);
38+
if (platform === "win32") {
39+
removeNextjsModules(
40+
electronModules,
41+
path.join(extractPath, "resources/app/node_modules"),
42+
);
43+
} else if (platform === "darwin") {
44+
removeNextjsModules(
45+
electronModules,
46+
"chisel-editor.app/Contents/Resources/app/node_modules",
47+
);
48+
} else if (platform === "linux") {
49+
removeNextjsModules(
50+
electronModules,
51+
path.join(extractPath, "resources/app/node_modules"),
52+
);
53+
}
4254

4355
done();
4456
},

0 commit comments

Comments
 (0)