Skip to content

Commit f92f325

Browse files
committed
Move error callback parsing after the finally block to ensure that any dependencies in the error callback are not put into the chunk
1 parent 139d5ab commit f92f325

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎lib/dependencies/RequireEnsureDependenciesBlockParserPlugin.js‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,21 @@ module.exports = class RequireEnsureDependenciesBlockParserPlugin {
7979
else
8080
parser.walkExpression(successExpression.fn.body);
8181
}
82-
if(errorExpression) {
83-
if(errorExpression.fn.body.type === "BlockStatement")
84-
parser.walkStatement(errorExpression.fn.body);
85-
else
86-
parser.walkExpression(errorExpression.fn.body);
87-
}
8882
old.addBlock(dep);
8983
} finally {
9084
parser.state.current = old;
9185
}
9286
if(!successExpression) {
9387
parser.walkExpression(successExpressionArg);
9488
}
89+
if(errorExpression) {
90+
if(errorExpression.fn.body.type === "BlockStatement")
91+
parser.walkStatement(errorExpression.fn.body);
92+
else
93+
parser.walkExpression(errorExpression.fn.body);
94+
} else if(errorExpressionArg) {
95+
parser.walkExpression(errorExpressionArg);
96+
}
9597
return true;
9698
}
9799
}

0 commit comments

Comments
 (0)