Skip to content

Commit 39a60b4

Browse files
committed
Fix transpilationDependencies transpiling for no reason
1 parent 2596045 commit 39a60b4

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ export default class Manager {
349349
verifyTreeTranspiled() {
350350
return Promise.all(
351351
this.getTranspiledModules()
352-
.filter(tModule => !tModule.source)
352+
.filter(tModule => tModule.shouldTranspile())
353353
.map(tModule => tModule.transpile(this))
354354
);
355355
}
@@ -689,7 +689,13 @@ export default class Manager {
689689
);
690690

691691
return Promise.all(
692-
transpiledModulesToUpdate.map(tModule => tModule.transpile(this))
692+
transpiledModulesToUpdate.map(tModule => {
693+
if (tModule.shouldTranspile()) {
694+
return tModule.transpile(this);
695+
}
696+
697+
return Promise.resolve(tModule);
698+
})
693699
);
694700
}
695701

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,17 @@ export default class TranspiledModule {
292292
}
293293
}
294294

295+
/**
296+
* Determines if this is a module that should be transpiled if updated. If this
297+
* is a transpilationDependency that's updated then it should not get transpiled, but the parent should.
298+
*/
299+
shouldTranspile() {
300+
return (
301+
!this.source &&
302+
!(this.initiators.size === 0 && this.transpilationInitiators.size > 0)
303+
);
304+
}
305+
295306
update(module: Module): TranspiledModule {
296307
if (this.module.path !== module.path || this.module.code !== module.code) {
297308
this.module = module;

0 commit comments

Comments
 (0)