fix(cli): check for inline source maps before external ones (#9394)

Fixes #6965
This commit is contained in:
Nayeem Rahman 2021-02-07 23:14:05 +00:00 committed by GitHub
parent 45b465f839
commit 0cac243a83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 6 deletions

View file

@ -296,12 +296,8 @@ impl SourceMapGetter for ProgramState {
fn get_source_map(&self, file_name: &str) -> Option<Vec<u8>> {
if let Ok(specifier) = ModuleSpecifier::resolve_url(file_name) {
if let Some((code, maybe_map)) = self.get_emit(&specifier.as_url()) {
if maybe_map.is_some() {
maybe_map
} else {
let code = String::from_utf8(code).unwrap();
source_map_from_code(code)
}
let code = String::from_utf8(code).unwrap();
source_map_from_code(code).or(maybe_map)
} else if let Ok(source) = self.load(specifier, None) {
source_map_from_code(source.code)
} else {