Apply dependencies update
[poolifier.git] / rollup.config.mjs
CommitLineData
61a90f2e 1import ts from 'rollup-plugin-ts'
f45e4999
JB
2import analyze from 'rollup-plugin-analyzer'
3import { terser } from 'rollup-plugin-terser'
660940b0 4import del from 'rollup-plugin-delete'
5ea22628 5import command from 'rollup-plugin-command'
5519f8f3 6import istanbul from 'rollup-plugin-istanbul'
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 },
660940b0
JB
22 external: ['async_hooks', 'cluster', 'events', 'worker_threads'],
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}