@@ -207,6 +207,16 @@ static std::string OnDiskFileName(const char* id) {
207
207
MaybeLocal<String> NativeModuleLoader::LoadBuiltinModuleSource (Isolate* isolate,
208
208
const char * id) {
209
209
#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
+ }
210
220
std::string filename = OnDiskFileName (id);
211
221
212
222
std::string contents;
@@ -222,13 +232,6 @@ MaybeLocal<String> NativeModuleLoader::LoadBuiltinModuleSource(Isolate* isolate,
222
232
}
223
233
return String::NewFromUtf8 (
224
234
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);
232
235
#endif // NODE_BUILTIN_MODULES_PATH
233
236
}
234
237
0 commit comments