Skip to content

Commit 4aee050

Browse files
authored
Fix native module cached paths (codesandbox#478)
1 parent a92581c commit 4aee050

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/app/src/sandbox/eval/manager.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,16 @@ export default class Manager {
384384

385385
if (NODE_LIBS.includes(shimmedPath) || resolvedPath === '//empty.js') {
386386
return {
387-
path: pathUtils.join('/node_modules', resolvedPath),
387+
path: pathUtils.join('/node_modules', 'empty', 'index.js'),
388388
code: `// empty`,
389389
requires: [],
390390
};
391391
}
392392

393393
return this.transpiledModules[resolvedPath].module;
394394
} catch (e) {
395+
delete this.cachedPaths[pathId];
396+
395397
let connectedPath = /^(\w|@\w)/.test(shimmedPath)
396398
? pathUtils.join('/node_modules', shimmedPath)
397399
: pathUtils.join(pathUtils.dirname(currentPath), shimmedPath);

0 commit comments

Comments
 (0)