-
Notifications
You must be signed in to change notification settings - Fork 10
/
rollup.config.js
53 lines (48 loc) · 1.07 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
46
47
48
49
50
51
52
53
import replace from '@rollup/plugin-replace';
import { terser } from 'rollup-plugin-terser';
import typescript from 'rollup-plugin-typescript2';
const packageInfo = require('./package.json');
const isDevelop = process.env.NODE_ENV === 'development';
const output = [
{
file: isDevelop ? './lib/index.dev.js' : './lib/index.js',
format: 'cjs',
},
];
if (!isDevelop) {
output.push({
file: './lib/index.es.js',
format: 'es',
});
output.push({
file: './lib/index.umd.js',
name: 'ReactStores',
format: 'umd',
globals: {
react: 'React',
},
});
}
export default [
{
input: ['./src/index.ts'],
output: output,
external: ['react'],
plugins: [
typescript({
tsconfigOverride: {
compilerOptions: {
declaration: true,
},
sourceMap: isDevelop,
include: ['./src/*.ts'],
},
}),
replace({
__VERSION__: JSON.stringify(packageInfo.version),
__IS_DEV__: JSON.stringify(isDevelop),
}),
!isDevelop && terser(),
],
},
];