Skip to content

Commit af04a07

Browse files
arthurdennerCompuIves
authored andcommitted
fix(svelte): add fallback toUrl method to generate sourcemaps (codesandbox#3114)
* fix(svelte): add fallback toUrl method to generate sourcemaps * chore(svelte): add comment to explain fallback generation of sourcemaps
1 parent 2e97931 commit af04a07

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/app/src/sandbox/eval/transpilers/svelte/svelte-worker.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ function getV3Code(code, version, path) {
3636
});
3737
});
3838

39+
// Fallback to generate sourcemaps on Svelte 3.13+
40+
// See https://github.com/codesandbox/codesandbox-client/pull/3114
41+
if (!js.map.toUrl) {
42+
js.map.toUrl = () =>
43+
'data:application/json;charset=utf-8;base64,' +
44+
btoa(JSON.stringify(js.map));
45+
}
46+
3947
return js;
4048
} catch (e) {
4149
return self.postMessage({

0 commit comments

Comments
 (0)