diff --git a/crates/swc/src/lib.rs b/crates/swc/src/lib.rs
index ba24f069dd9d..833403ac0489 100644
--- a/crates/swc/src/lib.rs
+++ b/crates/swc/src/lib.rs
@@ -269,99 +269,115 @@ impl Compiler {
self.run(|| -> Result<_, Error> {
let name = &fm.name;
- // Load original source map
- match input_src_map {
- InputSourceMap::Bool(false) => Ok(None),
- InputSourceMap::Bool(true) => {
- let s = "sourceMappingURL=";
- let idx = fm.src.rfind(s);
- let src_mapping_url = idx.map(|idx| &fm.src[idx + s.len()..]);
-
- // Load original source map if possible
- match &name {
- FileName::Real(filename) => {
- let dir = match filename.parent() {
+ let read_inline_sourcemap =
+ |data_url: Option<&str>| -> Result