Skip to content

Commit

Permalink
Flip conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
jridgewell committed Apr 23, 2022
1 parent cfa1c9b commit e2103a9
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/build-source-map-tree.ts
Expand Up @@ -71,19 +71,16 @@ function build(

const { source, content } = ctx;

// If there is no sourcemap, then it is an unmodified source file.
if (!sourceMap) {
// The contents of this unmodified source file can be overridden via the loader context,
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
// the importing sourcemap's `sourcesContent` field.
const sourceContent =
content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
return OriginalSource(source, sourceContent);
}
// If there is a sourcemap, then we need to recurse into it to load its source files.
if (sourceMap) return build(new TraceMap(sourceMap, source), loader, source, depth);

// Else, it's a real sourcemap, and we need to recurse into it to load its
// source files.
return build(new TraceMap(sourceMap, source), loader, source, depth);
// Else, it's an an unmodified source file.
// The contents of this unmodified source file can be overridden via the loader context,
// allowing it to be explicitly null or a string. If it remains undefined, we fall back to
// the importing sourcemap's `sourcesContent` field.
const sourceContent =
content !== undefined ? content : sourcesContent ? sourcesContent[i] : null;
return OriginalSource(source, sourceContent);
});

return MapSource(map, children);
Expand Down

0 comments on commit e2103a9

Please sign in to comment.