-
Notifications
You must be signed in to change notification settings - Fork 1
/
rollup.config.js
41 lines (39 loc) · 1.05 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
import buble from 'rollup-plugin-buble';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import uglify from 'rollup-plugin-uglify';
import conditional from 'rollup-plugin-conditional';
import replace from 'rollup-plugin-replace';
import filesize from 'rollup-plugin-filesize';
import { plugin as analyze } from 'rollup-plugin-analyzer'
const isProduction = process.env.NODE_ENV === 'production';
const nodeBuild = process.env.NODE_BUILD;
export default {
entry: './lib/vhx.js',
format: 'umd',
dest: JSON.parse(nodeBuild) ? './dist/index.js' : './dist/client.js',
moduleName: 'VhxApi',
sourceMap: true,
plugins: [
analyze(),
replace({
'process.env.NODE_BUILD': JSON.parse(nodeBuild),
}),
conditional(!JSON.parse(nodeBuild), [
nodeResolve({
browser: true,
jsnext: true,
main: true,
module: true
}),
]),
commonjs(),
buble(),
conditional(isProduction, [
uglify({
sourceMap: true
})
]),
filesize(),
]
};