diff --git a/webpack.config.ts b/webpack.config.ts index 45deee428..26dc4fea6 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -20,6 +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'; if (PLUGIN === undefined) { process.exit(1); @@ -86,7 +87,7 @@ const config: webpack.Configuration & DevServerConfiguration = { { loader: 'thread-loader', options: { - ...(NODE_ENV === 'development' + ...(!isProduction ? { poolTimeout: Infinity, poolRespawn: false } : OPENSHIFT_CI ? { @@ -153,13 +154,15 @@ const config: webpack.Configuration & DevServerConfiguration = { cwd: process.cwd(), }), ], - devtool: 'eval-cheap-module-source-map', + // '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', optimization: { chunkIds: 'named', }, }; -if (NODE_ENV === 'production' || process.env.DEV_NO_TYPE_CHECK !== 'true') { +if (isProduction || process.env.DEV_NO_TYPE_CHECK !== 'true') { config.plugins?.push( new ForkTsCheckerWebpackPlugin({ issue: {