-
Notifications
You must be signed in to change notification settings - Fork 8
/
rollem.config.js
57 lines (54 loc) · 1.16 KB
/
rollem.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
const buble = require('rollup-plugin-buble');
const uglify = require('rollup-plugin-uglify');
const replace = require('rollup-plugin-replace');
const commonjs = require('rollup-plugin-commonjs');
const bundles = [
'react',
'inferno',
'inferno-compat',
'preact',
'preact-compat'
]
const shared = {
format: 'umd',
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify('production')
}),
buble({
transforms: {
modules: false
}
}),
commonjs({
namedExports: {
'inferno': ['createVNode'],
'inferno-server': ['renderToString'],
'inferno-compat': ['Component', 'createElement'],
'preact': ['h', 'Component'],
'preact-compat': ['Component', 'createElement'],
'preact-compat/server': ['renderToString'],
'react': ['createElement', 'Component'],
'react-dom/server': ['renderToString'],
}
}),
uglify({
output: {
comments: 0
},
compress: {
unused: 1,
warnings: 1,
comparisons: 1,
conditionals: 1,
dead_code: 1,
if_return: 1,
join_vars: 1
}
})
]
}
module.exports = bundles.map(str => Object.assign({
entry: `./src/${str}.js`,
dest: `./src/${str}.bundle.js`
}, shared))