Skip to content

Commit 6b1faac

Browse files
authored
Fix evalAndReturn with comments at the bottom of a script
This is because beepbox's script: https://cdn.jsdelivr.net/npm/[email protected]/global/beepbox_synth.min.js has a sourceMappingURL comment at the bottom for whatever reason, causing it to become //# sourceMappingURL=beepbox_synth.min.js.map;return beepbox; This is obviously going to break and might also be the case with other libraries too, hot just beepbox. Ported from AmpMod: https://codeberg.org/ampmod/ampmod/commit/0daf1021bdc8e67a1f0d08b91ce500605fcaa711
1 parent fd13a98 commit 6b1faac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/extension-support/tw-external.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ external.blob = async url => {
7979
external.evalAndReturn = async (url, returnExpression) => {
8080
const res = await external.fetch(url);
8181
const text = await res.text();
82-
const js = `${text};return ${returnExpression}`;
82+
const js = `${text}\nreturn ${returnExpression};`;
8383
const fn = new Function(js);
8484
return fn();
8585
};

0 commit comments

Comments
 (0)