Skip to content

Commit 0496421

Browse files
author
Ives van Hoorne
committed
Fix empty modules
1 parent d293d17 commit 0496421

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/sandbox/eval/npm/fetch-npm-module.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function downloadDependency(depName: string, depVersion: string, path: string) {
8181
return x.text();
8282
}
8383

84-
return `throw new Error("Could not find module ${path}`;
84+
return `throw new Error("Could not find module ${path}")`;
8585
})
8686
.then(x => ({
8787
path,
@@ -167,6 +167,14 @@ export default async function fetchModule(
167167
return reject(err);
168168
}
169169

170+
if (resolvedPath === '//empty.js') {
171+
return res({
172+
path: '//empty.js',
173+
code: 'module.exports = {};',
174+
requires: [],
175+
});
176+
}
177+
170178
return res(downloadDependency(dependencyName, version, resolvedPath));
171179
}
172180
);

0 commit comments

Comments
 (0)