Skip to content

Commit 2354c97

Browse files
committed
Cleanup reading tmodule and fixing resolving async files
1 parent c3d3f31 commit 2354c97

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

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

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ export default class Manager {
274274
return this.fileResolver.readFile(p).then(code => {
275275
this.addModule({ code, path: p });
276276

277-
callback(code);
277+
callback(null, code);
278278
});
279279
}
280280

@@ -690,7 +690,12 @@ export default class Manager {
690690
}
691691

692692
if (!this.transpiledModules[foundPath]) {
693-
this.readFileSync(foundPath, code => {
693+
this.readFileSync(foundPath, (error, code) => {
694+
if (error) {
695+
promiseReject(error);
696+
return;
697+
}
698+
694699
this.addModule({ path: foundPath, code });
695700
promiseResolve(this.transpiledModules[foundPath].module);
696701
});
@@ -831,12 +836,12 @@ export default class Manager {
831836
const tModule =
832837
currentTModule || this.getTranspiledModule(this.modules['/package.json']); // Get arbitrary file from root
833838
try {
834-
const resolvedTModule = await this.resolveTranspiledModule(
839+
return this.resolveTranspiledModule(
835840
path,
836841
tModule.module.path,
837-
ignoredExtensions
842+
ignoredExtensions,
843+
true
838844
);
839-
return resolvedTModule;
840845
} catch (e) {
841846
if (e.type === 'module-not-found' && e.isDependency) {
842847
const { queryPath } = splitQueryFromPath(path);

packages/app/src/sandbox/eval/transpilers/babel/worker/babel-worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ self.addEventListener('message', async event => {
691691
!Babel.version.startsWith('6')
692692
);
693693
} catch (e) {
694+
console.warn(e);
694695
throw new Error(
695696
`Could not find/install babel plugin '${p}': ${e.message}`
696697
);

0 commit comments

Comments
 (0)