Skip to content

Commit

Permalink
fixup! implement webpack chunks file updating using ast manipulation
Browse files Browse the repository at this point in the history
introduce `functionUsesChunkInstallationVariables` to make code clearer
  • Loading branch information
dario-piotrowicz committed Sep 20, 2024
1 parent 12d1ed8 commit 50b65e2
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ export async function getFileContentWithUpdatedWebpackFRequireCode(
const binaryExpressionRight = binaryExpression.getRight();
const binaryExpressionRightText = binaryExpressionRight.getText();

if (
!binaryExpressionRightText.includes(installChunk) ||
!binaryExpressionRightText.includes(installedChunks)
)
return;
const functionUsesChunkInstallationVariables =
binaryExpressionRightText.includes(installChunk) &&
binaryExpressionRightText.includes(installedChunks);
if (!functionUsesChunkInstallationVariables) return;

if (!binaryExpressionRight.isKind(ts.SyntaxKind.ArrowFunction)) return;

Expand Down

0 comments on commit 50b65e2

Please sign in to comment.