We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2c3c12f commit 4077894Copy full SHA for 4077894
turbopack/crates/turbopack-core/src/code_builder.rs
@@ -187,8 +187,13 @@ impl Code {
187
}
188
last_byte_pos = *byte_pos;
189
190
- if pos.column != 0 || map.is_some() {
191
- sections.push((pos, map.clone().unwrap_or_else(SourceMap::empty_rope)))
+ if let Some(map) = map {
+ sections.push((pos, map.clone()))
192
+ } else {
193
+ // We don't need an empty source map when column is 0 or the next char is a newline.
194
+ if pos.column != 0 && read.fill_buf()?.first().is_some_and(|&b| b != b'\n') {
195
+ sections.push((pos, SourceMap::empty_rope()));
196
+ }
197
198
199
0 commit comments