Skip to content

Commit f0e0585

Browse files
panvaaduh95
authored andcommitted
build: fix --node-builtin-modules-path
PR-URL: #62115 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 4fd785e commit f0e0585

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
@@ -924,7 +924,13 @@
924924
},
925925
}],
926926
[ 'node_builtin_modules_path!=""', {
927-
'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ]
927+
'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ],
928+
# When loading builtins from disk, JS source files do not need to
929+
# trigger rebuilds since the binary reads them at runtime.
930+
'sources!': [
931+
'<@(library_files)',
932+
'<@(deps_files)',
933+
],
928934
}],
929935
[ 'node_shared=="true"', {
930936
'sources': [
@@ -1069,6 +1075,16 @@
10691075
'<@(deps_files)',
10701076
'config.gypi'
10711077
],
1078+
'conditions': [
1079+
[ 'node_builtin_modules_path!=""', {
1080+
# When loading builtins from disk, JS source files do not need
1081+
# to trigger rebuilds since the binary reads them at runtime.
1082+
'inputs!': [
1083+
'<@(library_files)',
1084+
'<@(deps_files)',
1085+
],
1086+
}],
1087+
],
10721088
'outputs': [
10731089
'<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
10741090
],

src/node_builtins.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ const BuiltinSource* BuiltinLoader::AddFromDisk(const char* id,
7272
const std::string& filename,
7373
const UnionBytes& source) {
7474
BuiltinSourceType type = GetBuiltinSourceType(id, filename);
75-
auto result = source_.write()->emplace(id, BuiltinSource{id, source, type});
75+
auto result =
76+
source_.write()->insert_or_assign(id, BuiltinSource{id, source, type});
7677
return &(result.first->second);
7778
}
7879

0 commit comments

Comments
 (0)