Skip to content

Commit

Permalink
fix clobbering of code because swc does not append a //# sourcemap co…
Browse files Browse the repository at this point in the history
…mment
  • Loading branch information
cspotcode committed Dec 10, 2020
1 parent 77436c3 commit f77e1b1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/compilers/swc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ const transpileModule: typeof ts.transpileModule = (input: string, transpileOpti
}
}
}
})
return { outputText: code, sourceMapText: map }
});
// HACK ts-node assumes the last line is a //# sourcemap comment from typescript that can be rewritten.
// We must add enough empty space that the rewriting doesn't clobber code
const outputText = code + '\n//# ';
const sourceMapText = map;
return { outputText, sourceMapText };
}
export = {
...require('typescript'),
Expand Down

0 comments on commit f77e1b1

Please sign in to comment.