X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=rollup.config.mjs;h=1410f161af83887ede02a8f98eb6bdcec7d35738;hb=c5d47229f35869b56a271612ef3fde64dd31c884;hp=99f833b4108e3f5b799b0310eef99d10ddde4122;hpb=5119cf1a3864eaadb079ae68df6d4dae1a52b2cb;p=poolifier.git diff --git a/rollup.config.mjs b/rollup.config.mjs index 99f833b4..1410f161 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,3 +1,4 @@ +import { cpus } from 'node:os' import terser from '@rollup/plugin-terser' import typescript from '@rollup/plugin-typescript' import analyze from 'rollup-plugin-analyzer' @@ -8,35 +9,37 @@ const isDevelopmentBuild = process.env.BUILD === 'development' const isAnalyzeBuild = process.env.ANALYZE const isDocumentationBuild = process.env.DOCUMENTATION +const maxWorkers = cpus().length / 2 + export default { input: 'src/index.ts', strictDeprecations: true, output: [ { format: 'cjs', - sourcemap: !!isDevelopmentBuild, ...(isDevelopmentBuild && { dir: 'lib', + sourcemap: true, preserveModules: true, preserveModulesRoot: 'src' }), ...(!isDevelopmentBuild && { file: 'lib/index.js', - plugins: [terser({ maxWorkers: 2 })] + plugins: [terser({ maxWorkers })] }) }, { format: 'esm', - sourcemap: !!isDevelopmentBuild, ...(isDevelopmentBuild && { dir: 'lib', + sourcemap: true, entryFileNames: '[name].mjs', preserveModules: true, preserveModulesRoot: 'src' }), ...(!isDevelopmentBuild && { file: 'lib/index.mjs', - plugins: [terser({ maxWorkers: 2 })] + plugins: [terser({ maxWorkers })] }) } ], @@ -46,6 +49,7 @@ export default { 'node:crypto', 'node:events', 'node:os', + 'node:perf_hooks', 'node:worker_threads' ], plugins: [