-
Notifications
You must be signed in to change notification settings - Fork 17
/
rollup.config.js
66 lines (60 loc) · 1.36 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
66
// Rollup plugins
import babel from 'rollup-plugin-babel';
import { uglify } from 'rollup-plugin-uglify';
import postcss from 'rollup-plugin-postcss';
// Postcss plugins
// import csstriangle from 'postcss-triangle';
import precss from 'precss';
import postcssUtilities from 'postcss-utilities';
import postcssPresetEnv from 'postcss-preset-env';
import cssnano from 'cssnano';
let plugins = [
postcss({
extensions: ['.css', '.scss'],
plugins: [
precss(),
postcssPresetEnv({ stage: 0 }),
cssnano(),
postcssUtilities()
],
}),
// eslint({
// exclude: [
// 'src/styles/**',
// ],
// }),
babel({
exclude: 'node_modules/**',
}),
];
let outputs = [
{
file: 'dist/d2b.cjs.js',
sourceMap: 'inline',
format: 'cjs',
},
{
file: 'dist/d2b.js',
format: 'iife',
globals: {d3: 'd3', 'd3-sankey': 'd3', 'd3-interpolate-path': 'd3', 'd3-svg-annotation': 'd3'},
sourceMap: 'inline',
name: 'd2b'
},
];
if (process.env.NODE_ENV === 'production') {
outputs = [
{
file: 'dist/d2b.min.js',
format: 'iife',
globals: {d3: 'd3', 'd3-sankey': 'd3', 'd3-interpolate-path': 'd3', 'd3-svg-annotation': 'd3'},
sourceMap: 'inline',
name: 'd2b'
}
];
plugins.push(uglify());
}
export default {
input: 'src/scripts/index.js',
output: outputs,
plugins: plugins,
};