Bump @typescript-eslint/eslint-plugin from 4.15.2 to 4.16.1 (#251)
[poolifier.git] / rollup.config.mjs
1 import typescript from 'rollup-plugin-typescript2'
2 import analyze from 'rollup-plugin-analyzer'
3 import { terser } from 'rollup-plugin-terser'
4 import del from 'rollup-plugin-delete'
5 import command from 'rollup-plugin-command'
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', 'worker_threads'],
22 plugins: [
23 typescript({
24 tsconfig: isDevelopmentBuild
25 ? 'tsconfig.development.json'
26 : 'tsconfig.json'
27 }),
28 del({
29 targets: ['lib/*']
30 }),
31 isAnalyze && analyze(),
32 isDocumentation && command('npm run typedoc')
33 ]
34 }