summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-05-03 18:35:39 +0200
committerGitHub <noreply@github.com>2023-05-03 16:35:39 +0000
commit246569f6d45852aa42d6f7fe6221fe4d9fa69e3c (patch)
tree9024e50260b0403e3495abebe24b38f5ca39d182
parent8e6c104907971a83f25c10b357dc7bd2b28a297f (diff)
fix(core): rebuild when JS sources for snapshotting change (#18976)
-rw-r--r--core/runtime.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/core/runtime.rs b/core/runtime.rs
index 5470a89b9..9676ce571 100644
--- a/core/runtime.rs
+++ b/core/runtime.rs
@@ -543,6 +543,29 @@ impl JsRuntime {
}
}
+ #[cfg(feature = "include_js_files_for_snapshotting")]
+ {
+ let js_sources = options
+ .extensions
+ .iter()
+ .flat_map(|ext| match ext.get_js_sources() {
+ Some(s) => s.to_owned(),
+ None => vec![],
+ })
+ .collect::<Vec<ExtensionFileSource>>();
+
+ if snapshot_options != snapshot_util::SnapshotOptions::None {
+ for source in &js_sources {
+ use crate::ExtensionFileSourceCode;
+ if let ExtensionFileSourceCode::LoadedFromFsDuringSnapshot(path) =
+ &source.code
+ {
+ println!("cargo:rerun-if-changed={}", path.display())
+ }
+ }
+ }
+ }
+
Rc::new(crate::modules::ExtModuleLoader::new(
options.module_loader,
esm_sources,