From 860ca7d777aca7ce9d546ceb10597aada24a132e Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Wed, 21 Jun 2023 18:33:40 +0200 Subject: [PATCH] Fix webpack code splitting (#3385) --- webpack.config.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/webpack.config.ts b/webpack.config.ts index 6cbd585a0..5453855c4 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -229,11 +229,19 @@ export default function createConfig( devtool: APP_ENV === 'production' && IS_ELECTRON ? undefined : 'source-map', - ...(APP_ENV !== 'production' && { - optimization: { - chunkIds: 'named', - }, - }), + optimization: { + ...(APP_ENV !== 'production' && { chunkIds: 'named' }), + ...(['production', 'staging'].includes(APP_ENV) && { + splitChunks: { + cacheGroups: { + default: { + chunks: 'all', + minSize: 1, + }, + }, + }, + }), + }, }; }