forked from redux-zero/redux-zero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
49 lines (42 loc) · 1020 Bytes
/
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
import typescript from 'rollup-plugin-typescript2'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
import peerDeps from 'rollup-plugin-peer-deps-external'
import uglify from 'rollup-plugin-uglify'
import filesize from 'rollup-plugin-filesize'
const format = process.env.NODE_ENV
const isUmd = format === 'umd'
function getFileName(file) {
if (isUmd) {
return `${file}.min.js`
}
return `${file}.js`
}
function getConfig(input, file) {
const conf = {
input,
name: 'redux-zero',
sourcemap: true,
output: {
file: getFileName(file),
format,
},
plugins: [
peerDeps(),
typescript(),
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs(),
],
}
isUmd && conf.plugins.push(uglify(), filesize())
return conf
}
const config = [
getConfig('./src/index.ts', 'dist/redux-zero'),
getConfig('./src/react/index.ts', 'react/index'),
]
export default config