Skip to content

Commit 9b8dbb9

Browse files
committed
Fix binary SVGs imported with svgr
1 parent 0a36349 commit 9b8dbb9

File tree

1 file changed

+14
-1
lines changed
  • packages/app/src/sandbox/eval/transpilers/svgr

1 file changed

+14
-1
lines changed

packages/app/src/sandbox/eval/transpilers/svgr/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,20 @@ class SVGRTranspiler extends Transpiler {
1212
previousExport: `"${loaderContext._module.module.path}"`,
1313
},
1414
};
15-
const result = await svgrTransform(code, state);
15+
16+
let downloadedCode = code;
17+
18+
if (code.startsWith('http')) {
19+
await fetch(code)
20+
.then(res => res.text())
21+
.then(r => {
22+
downloadedCode = r;
23+
});
24+
}
25+
26+
const result = await svgrTransform(downloadedCode, state);
27+
28+
console.log(result);
1629

1730
return {
1831
transpiledCode: result,

0 commit comments

Comments
 (0)