Skip to content

Commit 4b6aad5

Browse files
author
Ives van Hoorne
committed
Explicitly check for empty path imports
Fixes codesandbox#1078
1 parent 85c6af9 commit 4b6aad5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/app/src/sandbox/eval/transpiled-module.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,10 @@ export default class TranspiledModule {
816816
try {
817817
// eslint-disable-next-line no-inner-declarations
818818
function require(path: string) {
819+
if (path === '') {
820+
throw new Error('Cannot import an empty path');
821+
}
822+
819823
const usedPath = manager.getPresetAliasedPath(path);
820824
const bfsModule = BrowserFS.BFSRequire(usedPath);
821825

0 commit comments

Comments
 (0)