-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathrollup.config.js
45 lines (43 loc) · 1.35 KB
/
rollup.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import tempDir from 'temp-dir';
import {uglify} from 'rollup-plugin-uglify';
import dts from 'rollup-plugin-dts';
import commonjs from 'rollup-plugin-commonjs';
export default () => {
const minify = process.env.minify || false;
return [
{
input: 'src/index.ts',
output: {
file: minify ? 'build/index.min.js' : 'build/index.js',
name: 'croct',
format: 'iife',
sourcemap: true,
},
treeshake: {
propertyReadSideEffects: false
},
plugins: [
resolve(),
commonjs(),
typescript({
cacheRoot: `${tempDir}/.rpt2_cache`,
useTsconfigDeclarationDir: true
}),
minify ?
uglify({
compress: {
unused: true,
dead_code: true,
}
}) : {},
]
},
{
input: './build/declarations/index.d.ts',
output: [{file: 'build/index.d.ts', format: 'es'}],
plugins: [dts({respectExternal: true})],
},
];
};