Skip to content

Commit 319406f

Browse files
author
Ives van Hoorne
committed
Fix dependency resolving
1 parent 24ea629 commit 319406f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/sandbox/eval/js.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ export default function evaluateJS(
4747
require = function require(path: string) {
4848
// eslint-disable-line no-unused-vars
4949
if (/^\w/.test(path)) {
50+
// So it must be a dependency
51+
const dependencyManifest = manifest[path] || manifest[`${path}.js`];
52+
if (dependencyManifest) {
53+
return window.dependencies(dependencyManifest.id);
54+
} else {
55+
throw new DependencyNotFoundError(path);
56+
}
57+
} else {
5058
const module = resolveModule(
5159
path,
5260
modules,
@@ -67,14 +75,6 @@ export default function evaluateJS(
6775
? cache.exports
6876
: evalModule(module, modules, directories, manifest, depth + 1);
6977
}
70-
71-
// So it must be a dependency
72-
const dependencyManifest = manifest[path] || manifest[`${path}.js`];
73-
if (dependencyManifest) {
74-
return window.dependencies(dependencyManifest.id);
75-
} else {
76-
throw new DependencyNotFoundError(path);
77-
}
7878
};
7979

8080
const compiledCode = compileCode(mainModule.code, mainModule.title);

0 commit comments

Comments
 (0)