forked from Klortho/d3-flextree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
106 lines (104 loc) · 2.17 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import resolve from 'rollup-plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import uglify from 'rollup-plugin-uglify';
import commonjs from 'rollup-plugin-commonjs';
import copy from 'rollup-plugin-copy';
import json from 'rollup-plugin-json';
const configs = {
dev: {
input: 'index.js',
output: {
name: 'd3',
extend: true,
file: 'build/d3-flextree.js',
format: 'umd',
sourcemap: true,
},
plugins: [
json({
preferConst: true,
indent: ' ',
}),
resolve(),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
],
},
prod: {
input: 'index.js',
output: {
name: 'd3',
extend: true,
file: 'build/d3-flextree.min.js',
format: 'umd',
sourcemap: true,
},
plugins: [
json({
preferConst: true,
indent: ' ',
}),
resolve(),
commonjs(),
uglify(),
babel({
exclude: 'node_modules/**'
}),
],
},
demo: {
input: 'src/demo/script.js',
output: {
name: 'demo',
file: 'demo/bundle.js',
format: 'umd',
sourcemap: true,
},
onwarn(warning, warn) {
if (warning.code === 'CIRCULAR_DEPENDENCY') return;
warn(warning);
},
plugins: [
// FIXME: do we need this here?
json({
preferConst: true,
indent: ' ',
}),
resolve(),
commonjs(),
babel(),
copy({
"src/demo/index.html": "demo/index.html",
"src/demo/style.css": "demo/style.css",
verbose: true,
}),
],
},
test: {
input: 'src/test/main.js',
output: {
name: 'test',
file: 'test/bundle.js',
format: 'umd',
sourcemap: true,
},
plugins: [
json({
preferConst: true,
indent: ' ',
}),
resolve(),
commonjs(),
copy({
"src/test/test.html": "test/test.html",
"src/test/browser-tests.js": "test/browser-tests.js",
verbose: true,
}),
],
},
};
const product = process.env.BUILD || 'all';
const config = product === 'all' ? Object.values(configs) : configs[product];
export default config;