Skip to content

Commit 872c368

Browse files
author
Ives van Hoorne
committed
Support module syntax for dependencies
1 parent 37a99eb commit 872c368

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/sandbox/eval/manager.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,18 @@ export default class Manager {
9494
};
9595

9696
Object.keys(this.manifest.contents).forEach(path => {
97-
this.addModule({
97+
const module: Module = {
9898
path,
9999
code: this.manifest.contents[path].content,
100-
requires: this.manifest.contents[path].requires,
101-
});
100+
};
101+
102+
// Check if module syntax, only transpile when that's NOT the case
103+
// TODO move this check to the packager
104+
if (!/^(import|export)\s/gm.test(module.code)) {
105+
module.requires = this.manifest.contents[path].requires;
106+
}
107+
108+
this.addModule(module);
102109
});
103110
}
104111

0 commit comments

Comments
 (0)