diff --git a/.changeset/late-emus-wait.md b/.changeset/late-emus-wait.md new file mode 100644 index 000000000..4c7e1c5c0 --- /dev/null +++ b/.changeset/late-emus-wait.md @@ -0,0 +1,5 @@ +--- +'@farmfe/core': patch +--- + +fix css resource pot load sourcemap diff --git a/crates/compiler/src/generate/render_resource_pots.rs b/crates/compiler/src/generate/render_resource_pots.rs index f14492fcb..dc7b1ffb0 100644 --- a/crates/compiler/src/generate/render_resource_pots.rs +++ b/crates/compiler/src/generate/render_resource_pots.rs @@ -60,7 +60,12 @@ pub fn render_resource_pots_and_generate_resources( // to make sure the source map can be found. if let Some(mut source_map) = res.source_map { source_map.name = format!("{}.{}", r.name, source_map.resource_type.to_ext()); - let source_mapping_url = format!("\n//# sourceMappingURL=/{}", source_map.name); + + let source_mapping_url = if matches!(r.resource_type, ResourceType::Css) { + format!("\n/*# sourceMappingURL=/{} */", source_map.name) + } else { + format!("\n//# sourceMappingURL=/{}", source_map.name) + }; r.bytes.append(&mut source_mapping_url.as_bytes().to_vec()); resource_pot.add_resource(source_map.name.clone());