-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
55 lines (49 loc) · 1.41 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
// rollup.config.js
const PRODUCTION = 'production';
const isProd = process.env.NODE_ENV === PRODUCTION;
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const babel = require('rollup-plugin-babel');
const uglify = require('rollup-plugin-uglify');
const postcss = require('rollup-plugin-postcss');
const cssnext = require('postcss-cssnext');
const cssnano = require('cssnano');
//const buble = require('rollup-plugin-buble');
const pkg = require('./package.json')
const postcssPlugins = [cssnext()];
if (isProd) {
postcssPlugins.push(
cssnano({
preset: ['default', {
discardComments: {
removeAll: true
},
normalizeWhitespace: false
}]
})
);
}
const postcssConfig = {
extract: true,
extensions: [ '.css' ],
plugins: postcssPlugins
};
const defaultConfig = {
input: 'src/blender-ui.js',
output: {
file: `./dist/blender-ui${isProd ? '.min' : ''}.js`,
format: 'umd',
name: 'BlenderUI'
},
banner: `/*! Blender-UI - v${pkg.version} */\n`,
plugins: [
postcss(postcssConfig),
resolve(),
commonjs(),
babel({
exclude: 'node_modules/**'
}),
isProd && uglify()
]
};
export default defaultConfig;