From 509e904b46dca595dc59803516f9af85368a2860 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sun, 28 May 2023 13:29:52 +0200 Subject: [PATCH] build: optimize minification MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- rollup.config.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index 99f833b4..0d5964e5 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,3 +1,4 @@ +import os from 'os' import terser from '@rollup/plugin-terser' import typescript from '@rollup/plugin-typescript' import analyze from 'rollup-plugin-analyzer' @@ -8,6 +9,8 @@ const isDevelopmentBuild = process.env.BUILD === 'development' const isAnalyzeBuild = process.env.ANALYZE const isDocumentationBuild = process.env.DOCUMENTATION +const maxWorkers = os.cpus().length / 2 + export default { input: 'src/index.ts', strictDeprecations: true, @@ -22,7 +25,7 @@ export default { }), ...(!isDevelopmentBuild && { file: 'lib/index.js', - plugins: [terser({ maxWorkers: 2 })] + plugins: [terser({ maxWorkers })] }) }, { @@ -36,7 +39,7 @@ export default { }), ...(!isDevelopmentBuild && { file: 'lib/index.mjs', - plugins: [terser({ maxWorkers: 2 })] + plugins: [terser({ maxWorkers })] }) } ], -- 2.34.1