Skip to content

Commit 579fcdd

Browse files
authored
Refactor platform and arch logic in getTarget function (#185)
# Goal The goal of this PR is address a bug that only happens on Macos with x86 architecture on node library and tries to load the windows binary since both darwin and win32 contained `win` in it. Related to #154
1 parent 41c05d1 commit 579fcdd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

bridge/node/js/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ function getTarget(): String {
4343
const platform = os.platform().toLowerCase();
4444
const arch = os.arch().toLowerCase();
4545

46-
// Windows
47-
if (platform.includes("win") && arch.includes("x64")) {
48-
return "x86_64-pc-windows-msvc";
49-
50-
// MacOS
51-
} else if (platform.includes("darwin") && arch.includes("x64")) {
46+
// MacOS
47+
if (platform.includes("darwin") && arch.includes("x64")) {
5248
return "x86_64-apple-darwin";
5349
} else if (platform.includes("darwin") && arch.includes("arm64")) {
5450
return "aarch64-apple-darwin";
5551

52+
// Windows
53+
} else if (platform.includes("win") && arch.includes("x64")) {
54+
return "x86_64-pc-windows-msvc";
55+
5656
// Linux
5757
} else if (platform.includes("linux") && arch.includes("x64")) {
5858
return "x86_64-unknown-linux-gnu";

0 commit comments

Comments
 (0)