Skip to content

Commit

Permalink
Fix source-map
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed May 8, 2019
1 parent dfdeefe commit d24c80e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/repl/scopedEval.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ function getIframe() {
function scopedEval(code: string, sourceMap: ?string) {
// Append source map footer so errors map to pre-compiled code.
if (sourceMap) {
code = `${code}\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(
unescape(encodeURIComponent(sourceMap))
)}`;
code =
`${code}\n//` + // !! This is to avoid a bug with convert-source-map which would detect this line as valid sourcemap
`# sourceMappingURL=data:application/json;charset=utf-8;base64,${btoa(
unescape(encodeURIComponent(sourceMap))
)}`;
}

// Eval code within an iframe so that it can't eg unmount the REPL.
Expand Down

0 comments on commit d24c80e

Please sign in to comment.