Skip to content

Commit 3bfa815

Browse files
authored
Properly ignore node-addon-api gyp dependency MONGOSH-1039 (#22)
1 parent accfdfd commit 3bfa815

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/native-addons.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ function turnIntoStaticLibrary (config: GypConfig, addonId: string): AddonResult
7070
target['defines!'] = [...negDefines];
7171
target['win_delay_load_hook'] = 'false';
7272

73+
// Remove node-addon-api gyp dummy, which inserts nothing.c into
74+
// the build tree, which can conflict with other target's nothing.c
75+
// files.
76+
target['dependencies'] = target['dependencies']?.filter(
77+
dep => !/require\s*\(.+node-addon-api.+\)\s*\.\s*gyp/.test(dep)) ?? [];
78+
7379
result.push({
7480
targetName: target.target_name,
7581
registerFunction,
@@ -86,11 +92,6 @@ async function prepForUsageWithNode (
8692
(config.includes = config.includes || []).push(
8793
path.join(nodeGypDir, 'addon.gypi')
8894
);
89-
// Remove node-addon-api gyp dummy, which inserts nothing.c into
90-
// the build tree, which can conflict with other target's nothing.c
91-
// files.
92-
config.dependencies = config.dependencies?.filter(
93-
dep => !/require\s*\(.+node-addon-api.+\)\s*\.\s*gyp/.test(dep)) ?? [];
9495
config.variables = {
9596
...(config.variables || {}),
9697
'node_root_dir%': nodeSourcePath,

0 commit comments

Comments
 (0)