Skip to content

Commit

Permalink
Merge pull request #33 from hkaikai/main
Browse files Browse the repository at this point in the history
Fix: Handle scenario where rawSourceMap is a string
  • Loading branch information
yannbf authored May 7, 2024
2 parents 06584b3 + 280f528 commit c708138
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/loader/webpack5-istanbul-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ type RawSourceMap = {
names?: string[];
};

function sanitizeSourceMap(rawSourceMap: RawSourceMap): RawSourceMap {
function sanitizeSourceMap(rawSourceMap: RawSourceMap | string): RawSourceMap {
if (typeof rawSourceMap === 'string') return JSON.parse(rawSourceMap);
const { sourcesContent, ...sourceMap } = rawSourceMap ?? {};

// JSON parse/stringify trick required for istanbul to accept the SourceMap
Expand Down

0 comments on commit c708138

Please sign in to comment.