Fix poolifier benchmarks exit
[poolifier.git] / rollup.config.mjs
CommitLineData
f45e4999 1import analyze from 'rollup-plugin-analyzer'
5ea22628 2import command from 'rollup-plugin-command'
eae1fc25 3import del from 'rollup-plugin-delete'
5519f8f3 4import istanbul from 'rollup-plugin-istanbul'
eae1fc25
JB
5import { terser } from 'rollup-plugin-terser'
6import ts from 'rollup-plugin-ts'
660940b0
JB
7
8const isDevelopmentBuild = process.env.BUILD === 'development'
f4162974 9const isAnalyze = process.env.ANALYZE
5ea22628 10const isDocumentation = process.env.DOCUMENTATION
660940b0
JB
11
12export default {
13 input: 'src/index.ts',
f4162974
JB
14 output: {
15 ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.js' }),
16 format: 'cjs',
17 sourcemap: !!isDevelopmentBuild,
18 ...(isDevelopmentBuild && { preserveModules: true }),
19 ...(isDevelopmentBuild && { preserveModulesRoot: 'src' }),
20 ...(!isDevelopmentBuild && { plugins: [terser({ numWorkers: 2 })] })
21 },
23ff945a 22 external: ['async_hooks', 'cluster', 'events', 'os', 'worker_threads'],
660940b0 23 plugins: [
61a90f2e 24 ts({
660940b0
JB
25 tsconfig: isDevelopmentBuild
26 ? 'tsconfig.development.json'
61a90f2e
JB
27 : 'tsconfig.json',
28 browserslist: false
660940b0 29 }),
5519f8f3 30 isDevelopmentBuild && istanbul(),
660940b0 31 del({
f4162974 32 targets: ['lib/*']
f45e4999 33 }),
5ea22628
JB
34 isAnalyze && analyze(),
35 isDocumentation && command('npm run typedoc')
660940b0
JB
36 ]
37}