forked from jpb12/react-tree-graph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
65 lines (60 loc) · 1.26 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
54
55
56
57
58
59
60
61
62
63
64
65
import babel from 'rollup-plugin-babel';
import clear from 'rollup-plugin-clear';
import postcss from 'rollup-plugin-postcss';
import prettier from 'rollup-plugin-prettier';
import progress from 'rollup-plugin-progress';
import { uglify } from 'rollup-plugin-uglify';
import clone from 'clone';
const defaultConfig = {
external: [
'clone',
'core-js/fn/array/find',
'core-js/fn/object/assign',
'd3-hierarchy',
'd3-ease',
'prop-types',
'react'
],
input: 'src/index.js',
output: {
format: 'umd',
globals: {
'prop-types': 'PropTypes',
react: 'React',
clone: 'clone',
'd3-ease': 'd3',
'd3-hierarchy': 'd3'
},
interop: false,
name: 'ReactTreeGraph'
},
plugins: [
babel({
exclude: 'node_modules/**'
}),
clear({
targets: ['dist']
}),
progress()
]
};
const devConfig = clone(defaultConfig);
devConfig.output.file = 'dist/index.js';
devConfig.plugins.push(prettier({
singleQuote: true,
useTabs: true
}));
devConfig.plugins.unshift(postcss({
extract: 'dist/style.css'
}));
const prodConfig = clone(defaultConfig);
prodConfig.output.file = 'dist/index.min.js';
prodConfig.plugins.push(uglify());
prodConfig.plugins.unshift(postcss({
extract: 'dist/style.min.css',
minimize: true
}));
export default [
devConfig,
prodConfig
];