Skip to content

Commit cc120f4

Browse files
author
Ives van Hoorne
committed
Extra fixes for dynamic stubbed modules
1 parent 7982657 commit cc120f4

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

packages/app/src/app/components/CodeEditor/Monaco/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ class MonacoEditor extends React.Component<Props, State> implements Editor {
262262
this.initializeModules(sandbox.modules);
263263
await this.openNewModel(currentModule);
264264

265-
// this.addKeyCommands();
266-
267265
window.addEventListener('resize', this.resizeEditor);
268266
this.sizeProbeInterval = setInterval(() => {
269267
if (this.props.absoluteWidth && this.props.absoluteHeight) {

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,12 @@ export default async function fetchModule(
314314
// Mark the path of the module as the real module, because during evaluation
315315
// we don't have meta to find which modules are browser modules and we still
316316
// need to return an empty module for browser modules.
317+
const isDependency = /^(\w|@\w)/.test(path);
318+
317319
return {
318-
path: pathUtils.join(currentPath, path),
320+
path: isDependency
321+
? pathUtils.join('/node_modules', path)
322+
: pathUtils.join(currentPath, path),
319323
code: 'module.exports = {};',
320324
requires: [],
321325
};

0 commit comments

Comments
 (0)