diff --git a/src/node_sea.cc b/src/node_sea.cc index ab7358e19fc40f..a8dbfeaa424943 100644 --- a/src/node_sea.cc +++ b/src/node_sea.cc @@ -486,16 +486,15 @@ ExitCode GenerateSingleExecutableBlob( } } - std::optional optional_code_cache = - GenerateCodeCache(config.main_path, main_script); - if (!optional_code_cache.has_value()) { - FPrintF(stderr, "Cannot generate V8 code cache\n"); - return ExitCode::kGenericUserError; - } - std::optional optional_sv_code_cache; std::string code_cache; if (static_cast(config.flags & SeaFlags::kUseCodeCache)) { + std::optional optional_code_cache = + GenerateCodeCache(config.main_path, main_script); + if (!optional_code_cache.has_value()) { + FPrintF(stderr, "Cannot generate V8 code cache\n"); + return ExitCode::kGenericUserError; + } code_cache = optional_code_cache.value(); optional_sv_code_cache = code_cache; }