fix(es/codegen): Exclude synthesized files from sourcemap (#4714)

This commit is contained in:
Donny/강동윤 2022-05-20 13:07:16 +09:00 committed by GitHub
parent 38abde1b44
commit 03dd9de1c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -604,6 +604,14 @@ impl SourceMapGenConfig for SwcSourceMapConfig<'_> {
fn emit_columns(&self, _f: &FileName) -> bool { fn emit_columns(&self, _f: &FileName) -> bool {
self.emit_columns self.emit_columns
} }
fn skip(&self, f: &FileName) -> bool {
if let FileName::Custom(s) = f {
s.starts_with('<')
} else {
false
}
}
} }
pub(crate) fn minify_file_comments( pub(crate) fn minify_file_comments(

View File

@ -1205,6 +1205,9 @@ impl SourceMap {
&f &f
} }
}; };
if config.skip(&f.name) {
continue;
}
let emit_columns = config.emit_columns(&f.name); let emit_columns = config.emit_columns(&f.name);
@ -1342,6 +1345,10 @@ pub trait SourceMapGenConfig {
fn emit_columns(&self, _f: &FileName) -> bool { fn emit_columns(&self, _f: &FileName) -> bool {
true true
} }
fn skip(&self, _f: &FileName) -> bool {
false
}
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]