Skip to content

Commit

Permalink
fix: don't include source maps in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Mar 6, 2024
1 parent 7542d10 commit 7718e90
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions runtime/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,17 @@ pub fn maybe_transpile_source(
let transpiled_source = parsed.transpile(&deno_ast::EmitOptions {
imports_not_used_as_values: deno_ast::ImportsNotUsedAsValues::Remove,
inline_source_map: false,
source_map: cfg!(debug_assertions),
source_map: true,
..Default::default()
})?;

let maybe_source_map: Option<SourceMapData> = transpiled_source
.source_map
.map(|sm| sm.into_bytes().into());
let maybe_source_map: Option<SourceMapData> = if cfg!(debug_assertions) {
transpiled_source
.source_map
.map(|sm| sm.into_bytes().into())
} else {
None
};

Ok((transpiled_source.text.into(), maybe_source_map))
}

0 comments on commit 7718e90

Please sign in to comment.