Unverified Commit 5e11e677 authored by Will Binns-Smith's avatar Will Binns-Smith Committed by GitHub

Turbopack: Pass hmr_enabled to ImportMetaBinding (#91118)

`is_hot_module_replacement_enabled` was removed from ChunkingContexts.
Instead, pass it through from CompileTimeInfo when constructing
ImportMetaBinding during analysis.

Test Plan: CI
parent 15d9b717
......@@ -31,11 +31,12 @@ use crate::{
)]
pub struct ImportMetaBinding {
path: FileSystemPath,
hmr_enabled: bool,
}
impl ImportMetaBinding {
pub fn new(path: FileSystemPath) -> Self {
ImportMetaBinding { path }
pub fn new(path: FileSystemPath, hmr_enabled: bool) -> Self {
ImportMetaBinding { path, hmr_enabled }
}
pub async fn code_generation(
......@@ -63,7 +64,7 @@ impl ImportMetaBinding {
},
);
let hmr_enabled = *chunking_context.is_hot_module_replacement_enabled().await?;
let hmr_enabled = self.hmr_enabled;
// [NOTE] url property is lazy-evaluated, as it should be computed once
// turbopack_runtime injects a function to calculate an absolute path.
......
......@@ -1585,6 +1585,9 @@ async fn analyze_ecmascript_module_internal(
analysis_state.first_import_meta = false;
analysis.add_code_gen(ImportMetaBinding::new(
source.ident().path().owned().await?,
analysis_state
.compile_time_info_ref
.hot_module_replacement_enabled,
));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment