Skip to content

Commit deb4adf

Browse files
committed
Fallback to napi build binding location to simplify local dev
1 parent a354693 commit deb4adf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,11 @@ function getNativeBinding({ platform, arch }) {
2626
name += '-msvc'
2727
}
2828

29-
return require(`./npm/${name}/binding.node`)
29+
try {
30+
return require(`./npm/${name}/binding.node`)
31+
} catch (err) {
32+
// Fallback to top-level build file (what `napi build` produces)
33+
// This simplifies local dev a bit.
34+
return require(`./php.${name}.node`)
35+
}
3036
}

0 commit comments

Comments
 (0)