1 import terser from '@rollup/plugin-terser'
2 import typescript from '@rollup/plugin-typescript'
3 import analyze from 'rollup-plugin-analyzer'
4 import command from 'rollup-plugin-command'
5 import del from 'rollup-plugin-delete'
7 const isDevelopmentBuild = process.env.BUILD === 'development'
8 const isAnalyze = process.env.ANALYZE
9 const isDocumentation = process.env.DOCUMENTATION
12 input: 'src/index.ts',
13 strictDeprecations: true,
16 ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.js' }),
18 sourcemap: !!isDevelopmentBuild,
19 ...(isDevelopmentBuild && {
20 preserveModules: true,
21 preserveModulesRoot: 'src'
23 ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] })
26 ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.mjs' }),
28 sourcemap: !!isDevelopmentBuild,
29 ...(isDevelopmentBuild && {
30 entryFileNames: '[name].mjs',
31 preserveModules: true,
32 preserveModulesRoot: 'src'
34 ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] })
47 tsconfig: isDevelopmentBuild
48 ? 'tsconfig.development.json'
49 : 'tsconfig.production.json'
54 isAnalyze && analyze(),
55 isDocumentation && command('pnpm run typedoc')