From 50b65e2d29ca8256e32fca67382e835045c6d2f8 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Fri, 20 Sep 2024 17:03:32 +0100 Subject: [PATCH] fixup! implement webpack chunks file updating using ast manipulation introduce `functionUsesChunkInstallationVariables` to make code clearer --- ...t-file-content-with-updated-webpack-f-require-code.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/builder/src/build/patches/investigated/update-webpack-chunks-file/get-file-content-with-updated-webpack-f-require-code.ts b/builder/src/build/patches/investigated/update-webpack-chunks-file/get-file-content-with-updated-webpack-f-require-code.ts index bd7fa5f..60b3b17 100644 --- a/builder/src/build/patches/investigated/update-webpack-chunks-file/get-file-content-with-updated-webpack-f-require-code.ts +++ b/builder/src/build/patches/investigated/update-webpack-chunks-file/get-file-content-with-updated-webpack-f-require-code.ts @@ -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;