From 8ee3cc8767fc7c7439872448114f48f0f0b0fd33 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Sun, 15 Jan 2023 17:37:26 +0100 Subject: [PATCH] feat(build): optimize build --- webpack.config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webpack.config.js b/webpack.config.js index 877f023..fac3947 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -8,6 +8,8 @@ if (!Encore.isRuntimeEnvironmentConfigured()) { Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev'); } +const TERSER_PARALLEL = process.env.hasOwnProperty('CPU_COUNT') ? parseInt(process.env.CPU_COUNT) : true; + Encore // directory where compiled assets will be stored .setOutputPath('public/build/') @@ -52,7 +54,7 @@ Encore }) .configureTerserPlugin((config) => { - config.parallel = process.env.CPU_COUNT || true; + config.parallel = TERSER_PARALLEL; }) // enables @babel/preset-env polyfills