diff --git a/src/node_sea.cc b/src/node_sea.cc index 8c4e3b3579fceb..fb9f933a19fa70 100644 --- a/src/node_sea.cc +++ b/src/node_sea.cc @@ -355,7 +355,14 @@ std::optional ParseSingleExecutableConfig( return std::nullopt; } if (use_code_cache.value()) { - result.flags |= SeaFlags::kUseCodeCache; + if (use_snapshot.value()) { + // TODO(joyeecheung): code cache in snapshot should be configured by + // separate snapshot configurations. + FPrintF(stderr, + "\"useCodeCache\" is redundant when \"useSnapshot\" is true\n"); + } else { + result.flags |= SeaFlags::kUseCodeCache; + } } auto assets_opt = parser.GetTopLevelStringDict("assets"); @@ -511,19 +518,14 @@ ExitCode GenerateSingleExecutableBlob( std::optional optional_sv_code_cache; std::string code_cache; if (static_cast(config.flags & SeaFlags::kUseCodeCache)) { - if (builds_snapshot_from_main) { - FPrintF(stderr, - "\"useCodeCache\" is redundant when \"useSnapshot\" is true\n"); - } else { - 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; + 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; } std::unordered_map assets;