Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't include source maps in release mode #22751

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should just fix this in deno_ast instead of landing this somewhat of a hack? It's a few lines of code change to fix it there and then we can do a quick patch release.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can fix it in deno_ast right now. Just give me a few minutes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped deno_ast


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