diff --git a/node.gyp b/node.gyp index 2dd7eb1af5865a..1366e1a0cd3505 100644 --- a/node.gyp +++ b/node.gyp @@ -948,7 +948,13 @@ }, }], [ 'node_builtin_modules_path!=""', { - 'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ] + 'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ], + # When loading builtins from disk, JS source files do not need to + # trigger rebuilds since the binary reads them at runtime. + 'sources!': [ + '<@(library_files)', + '<@(deps_files)', + ], }], [ 'node_shared=="true"', { 'sources': [ @@ -1103,6 +1109,16 @@ '<@(deps_files)', 'config.gypi' ], + 'conditions': [ + [ 'node_builtin_modules_path!=""', { + # When loading builtins from disk, JS source files do not need + # to trigger rebuilds since the binary reads them at runtime. + 'inputs!': [ + '<@(library_files)', + '<@(deps_files)', + ], + }], + ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', ], diff --git a/src/node_builtins.cc b/src/node_builtins.cc index 5ef8d06933700c..318ff5158e9c28 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -74,7 +74,8 @@ const BuiltinSource* BuiltinLoader::AddFromDisk(const char* id, const std::string& filename, const UnionBytes& source) { BuiltinSourceType type = GetBuiltinSourceType(id, filename); - auto result = source_.write()->emplace(id, BuiltinSource{id, source, type}); + auto result = + source_.write()->insert_or_assign(id, BuiltinSource{id, source, type}); return &(result.first->second); }