From: Jérôme Benoit Date: Sun, 28 May 2023 11:43:29 +0000 (+0200) Subject: Merge branch 'master' into interleaved-weighted-round-robin-worker-choice-strategy X-Git-Tag: v2.5.0~3^2~21 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=de037b034ea2cbc5530d45dd24685fde95a66155;hp=644992db7bd22ca02c9610f7d622d7973f861d0b;p=poolifier.git Merge branch 'master' into interleaved-weighted-round-robin-worker-choice-strategy --- diff --git a/rollup.config.mjs b/rollup.config.mjs index 02fc54c0..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,30 +9,38 @@ 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, output: [ { - ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.js' }), format: 'cjs', sourcemap: !!isDevelopmentBuild, ...(isDevelopmentBuild && { + dir: 'lib', preserveModules: true, preserveModulesRoot: 'src' }), - ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }) + ...(!isDevelopmentBuild && { + file: 'lib/index.js', + plugins: [terser({ maxWorkers })] + }) }, { - ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.mjs' }), format: 'esm', sourcemap: !!isDevelopmentBuild, ...(isDevelopmentBuild && { + dir: 'lib', entryFileNames: '[name].mjs', preserveModules: true, preserveModulesRoot: 'src' }), - ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] }) + ...(!isDevelopmentBuild && { + file: 'lib/index.mjs', + plugins: [terser({ maxWorkers })] + }) } ], external: [