Skip to content

Commit

Permalink
chore: simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
hosseinmd committed Sep 30, 2024
1 parent 46fed29 commit 404658e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/repack/src/modules/ScriptManager/ScriptManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,12 @@ export class ScriptManager extends EventEmitter {
const uniqueId = Script.getScriptUniqueId(scriptId, caller);
if (this.scriptsPromises[uniqueId]) {
const { isPrefetch } = this.scriptsPromises[uniqueId];
await this.scriptsPromises[uniqueId];

// prefetch is not execute the script so we need to run loadScript if promise is for prefetch
if (!isPrefetch) {
return Promise.resolve();
if(isPrefetch){
await this.scriptsPromises[uniqueId];
}else{
return this.scriptsPromises[uniqueId];
}
}
const loadProcess = async () => {
Expand Down

0 comments on commit 404658e

Please sign in to comment.