Skip to content

Commit d1575c6

Browse files
committed
Attempting to fix the Windows build path for Electron
1 parent c37252a commit d1575c6

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

electron-builder.config.cjs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,25 @@ const nativeBridgeResources = [
2424
{ from: "native/bridge/darwin-arm64", to: "bridge/darwin-arm64", filter: ["**/*"] }
2525
].filter(({ from }) => existsSync(from));
2626

27+
// Do not package cross-platform native addons; Windows signing rejects non-PE .node files.
28+
const windowsNativeBinaryExcludes = [
29+
"!**/node_modules/**/prebuilds/darwin*/**",
30+
"!**/node_modules/**/prebuilds/linux*/**",
31+
"!**/node_modules/**/prebuilds/win32-ia32/**",
32+
"!**/node_modules/**/prebuilds/win32-arm64/**",
33+
"!**/node_modules/**/bin/napi-*/darwin/**",
34+
"!**/node_modules/**/bin/napi-*/linux/**",
35+
"!**/node_modules/**/bin/napi-*/win32/ia32/**",
36+
"!**/node_modules/**/bin/napi-*/win32/arm64/**"
37+
];
38+
39+
const macNativeBinaryExcludes = [
40+
"!**/node_modules/**/prebuilds/linux*/**",
41+
"!**/node_modules/**/prebuilds/win32*/**",
42+
"!**/node_modules/**/bin/napi-*/linux/**",
43+
"!**/node_modules/**/bin/napi-*/win32/**"
44+
];
45+
2746
module.exports = {
2847
appId: "org.liteforms.web",
2948
productName: "Liteforms",
@@ -61,10 +80,12 @@ module.exports = {
6180
extraResources: nativeBridgeResources,
6281
win: {
6382
...windowsSigningConfig,
83+
files: windowsNativeBinaryExcludes,
6484
signExts: [".dll", ".node"],
6585
target: ["nsis"]
6686
},
6787
mac: {
88+
files: macNativeBinaryExcludes,
6889
target: ["dmg"],
6990
category: "public.app-category.entertainment",
7091
hardenedRuntime: true,

electron/electronBuild.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,28 @@ describe("Electron build configuration", () => {
108108
);
109109
expect(builderConfig.win).toEqual(
110110
expect.objectContaining({
111+
files: expect.arrayContaining([
112+
"!**/node_modules/**/prebuilds/darwin*/**",
113+
"!**/node_modules/**/prebuilds/linux*/**",
114+
"!**/node_modules/**/prebuilds/win32-ia32/**",
115+
"!**/node_modules/**/prebuilds/win32-arm64/**",
116+
"!**/node_modules/**/bin/napi-*/darwin/**",
117+
"!**/node_modules/**/bin/napi-*/linux/**",
118+
"!**/node_modules/**/bin/napi-*/win32/ia32/**",
119+
"!**/node_modules/**/bin/napi-*/win32/arm64/**"
120+
]),
111121
signExts: [".dll", ".node"],
112122
signAndEditExecutable: false
113123
})
114124
);
115125
expect(builderConfig.mac).toEqual(
116126
expect.objectContaining({
127+
files: expect.arrayContaining([
128+
"!**/node_modules/**/prebuilds/linux*/**",
129+
"!**/node_modules/**/prebuilds/win32*/**",
130+
"!**/node_modules/**/bin/napi-*/linux/**",
131+
"!**/node_modules/**/bin/napi-*/win32/**"
132+
]),
117133
hardenedRuntime: true,
118134
gatekeeperAssess: false,
119135
notarize: false

0 commit comments

Comments
 (0)