Skip to content

Commit 561e84a

Browse files
committed
Require the addon directly instead of through bindings
The bindings package earns its place when an addon has to be found across the several output directories node-gyp might have used. This addon is built by cmake-rn to one known location, so a plain require says the same thing with one less dependency — and it exercises the Babel plugin's ordinary require path rather than its bindings special case. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ugFE6vmMUVMTuoupvhMhX
1 parent aec0ef8 commit 561e84a

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

packages/node-addon-examples/tests/module-register/addon.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const assert = require("assert");
2-
const addon = require("bindings")("addon.node");
2+
// cmake-rn emits to {targetSourceDir}/build/{configuration}, and this package's
3+
// build script pins the configuration.
4+
const addon = require("./build/RelWithDebInfo/addon.node");
35

46
module.exports = () => {
57
assert.strictEqual(addon.registration(), "napi_module_register");

packages/node-addon-examples/tests/module-register/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@
33
"version": "0.0.0",
44
"description": "Tests of the deprecated napi_module_register registration",
55
"main": "addon.js",
6-
"private": true,
7-
"dependencies": {
8-
"bindings": "~1.5.0"
9-
}
6+
"private": true
107
}

0 commit comments

Comments
 (0)