We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 17fd487 commit 6795fddCopy full SHA for 6795fdd
packages/app/src/sandbox/eval/transpilers/raw/index.js
@@ -6,11 +6,18 @@ class RawTranspiler extends Transpiler {
6
super('raw-loader');
7
}
8
9
- doTranspilation(code: string) {
10
- return Promise.resolve({
11
- transpiledCode: `
12
- module.exports = ${JSON.stringify(code)};`,
13
- });
+ async doTranspilation(code: string) {
+ // code is a URL, this is probably a binary module, load its contents
+ if (code.substr(0, 4) === 'http') {
+ const res = await fetch(code);
+ const text = await res.text();
14
+ return {
15
+ transpiledCode: `module.exports = ${JSON.stringify(text)};`,
16
+ };
17
+ }
18
19
+ transpiledCode: `module.exports = ${JSON.stringify(code)};`,
20
21
22
23
0 commit comments