From 3f10be606481777bc6ac86626ab3519d1c022a1d Mon Sep 17 00:00:00 2001 From: Gowtham Shanmugasundaram Date: Wed, 21 Aug 2024 13:38:21 +0530 Subject: [PATCH] Optimizing the chunk size for production Signed-off-by: Gowtham Shanmugasundaram --- webpack.config.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webpack.config.ts b/webpack.config.ts index 26dc4fea6..42bc37791 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -20,7 +20,7 @@ const NODE_ENV = (process.env.NODE_ENV || 'development') as webpack.Configuration['mode']; const PLUGIN = process.env.PLUGIN; const OPENSHIFT_CI = process.env.OPENSHIFT_CI; -const isProduction = NODE_ENV === 'production'; +const IS_PRODUCTION = NODE_ENV === 'production'; if (PLUGIN === undefined) { process.exit(1); @@ -87,7 +87,7 @@ const config: webpack.Configuration & DevServerConfiguration = { { loader: 'thread-loader', options: { - ...(!isProduction + ...(!IS_PRODUCTION ? { poolTimeout: Infinity, poolRespawn: false } : OPENSHIFT_CI ? { @@ -156,13 +156,13 @@ const config: webpack.Configuration & DevServerConfiguration = { ], // 'source-map' is recommended choice for production builds, A full SourceMap is emitted as a separate file. // 'eval-source-map' is recommended for development but 'eval-cheap-module-source-map' is faster and gives better result. - devtool: isProduction ? 'source-map' : 'eval-cheap-module-source-map', + devtool: IS_PRODUCTION ? 'source-map' : 'eval-cheap-module-source-map', optimization: { chunkIds: 'named', }, }; -if (isProduction || process.env.DEV_NO_TYPE_CHECK !== 'true') { +if (IS_PRODUCTION || process.env.DEV_NO_TYPE_CHECK !== 'true') { config.plugins?.push( new ForkTsCheckerWebpackPlugin({ issue: {