@@ -207,6 +207,16 @@ static std::string OnDiskFileName(const char* id) {
207207MaybeLocal<String> NativeModuleLoader::LoadBuiltinModuleSource (Isolate* isolate,
208208 const char * id) {
209209#ifdef NODE_BUILTIN_MODULES_PATH
210+ if (strncmp (id, " embedder_main_" , strlen (" embedder_main_" )) == 0 ) {
211+ #endif // NODE_BUILTIN_MODULES_PATH
212+ const auto source_it = source_.find (id);
213+ if (UNLIKELY (source_it == source_.end ())) {
214+ fprintf (stderr, " Cannot find native builtin: \" %s\" .\n " , id);
215+ ABORT ();
216+ }
217+ return source_it->second .ToStringChecked (isolate);
218+ #ifdef NODE_BUILTIN_MODULES_PATH
219+ }
210220 std::string filename = OnDiskFileName (id);
211221
212222 std::string contents;
@@ -222,13 +232,6 @@ MaybeLocal<String> NativeModuleLoader::LoadBuiltinModuleSource(Isolate* isolate,
222232 }
223233 return String::NewFromUtf8 (
224234 isolate, contents.c_str (), v8::NewStringType::kNormal , contents.length ());
225- #else
226- const auto source_it = source_.find (id);
227- if (UNLIKELY (source_it == source_.end ())) {
228- fprintf (stderr, " Cannot find native builtin: \" %s\" .\n " , id);
229- ABORT ();
230- }
231- return source_it->second .ToStringChecked (isolate);
232235#endif // NODE_BUILTIN_MODULES_PATH
233236}
234237
0 commit comments