Skip to content

Commit 22be1a2

Browse files
committed
build: fix --node-builtin-modules-path
1 parent 330e3ee commit 22be1a2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

node.gyp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,13 @@
948948
},
949949
}],
950950
[ 'node_builtin_modules_path!=""', {
951-
'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ]
951+
'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ],
952+
# When loading builtins from disk, JS source files do not need to
953+
# trigger rebuilds since the binary reads them at runtime.
954+
'sources!': [
955+
'<@(library_files)',
956+
'<@(deps_files)',
957+
],
952958
}],
953959
[ 'node_shared=="true"', {
954960
'sources': [
@@ -1103,6 +1109,16 @@
11031109
'<@(deps_files)',
11041110
'config.gypi'
11051111
],
1112+
'conditions': [
1113+
[ 'node_builtin_modules_path!=""', {
1114+
# When loading builtins from disk, JS source files do not need
1115+
# to trigger rebuilds since the binary reads them at runtime.
1116+
'inputs!': [
1117+
'<@(library_files)',
1118+
'<@(deps_files)',
1119+
],
1120+
}],
1121+
],
11061122
'outputs': [
11071123
'<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
11081124
],

src/node_builtins.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ const BuiltinSource* BuiltinLoader::AddFromDisk(const char* id,
7474
const std::string& filename,
7575
const UnionBytes& source) {
7676
BuiltinSourceType type = GetBuiltinSourceType(id, filename);
77-
auto result = source_.write()->emplace(id, BuiltinSource{id, source, type});
77+
auto result =
78+
source_.write()->insert_or_assign(id, BuiltinSource{id, source, type});
7879
return &(result.first->second);
7980
}
8081

0 commit comments

Comments
 (0)