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