From 1d791a78f5568a478430e857d35dc704c2eb7475 Mon Sep 17 00:00:00 2001 From: pshu Date: Tue, 17 Dec 2024 18:37:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20hash=20when=20necessary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/mako/src/generate/chunk_pot/ast_impl.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/mako/src/generate/chunk_pot/ast_impl.rs b/crates/mako/src/generate/chunk_pot/ast_impl.rs index 651f2bd59..793d041ad 100644 --- a/crates/mako/src/generate/chunk_pot/ast_impl.rs +++ b/crates/mako/src/generate/chunk_pot/ast_impl.rs @@ -330,7 +330,12 @@ fn render_entry_chunk_js_without_full_hash( let (buf, source_map_buf) = util::render_module_js(&ast.ast, context)?; - let hash = Some(file_content_hash(&buf)); + let hash = if context.config.hash || context.config.output.filename.is_some() { + crate::mako_profile_scope!("entryHash"); + Some(file_content_hash(&buf)) + } else { + None + }; Ok(RenderedChunk { content: buf,