-
Notifications
You must be signed in to change notification settings - Fork 287
/
rollup.config.js
56 lines (52 loc) · 1.29 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
import resolve from 'rollup-plugin-node-resolve';
import livereload from 'rollup-plugin-livereload';
import babel from 'rollup-plugin-babel';
import { eslint } from 'rollup-plugin-eslint';
import { uglify } from 'rollup-plugin-uglify';
import commonjs from '@rollup/plugin-commonjs';
const { name, version, license, author, homepage } = require('./package.json');
const production = !process.env.ROLLUP_WATCH;
const banner = `/*! ${name} v${version} | ${license} (c) ${new Date().getFullYear()} ${author.name} | ${homepage} */`;
const outputs = [];
if(production) {
outputs.push({
file: 'dist/cms.min.js',
name: 'CMS',
format: 'iife',
banner: banner,
plugins: [
uglify({ output: { comments: /^!/ } }),
],
});
outputs.push({
file: 'dist/cms.js',
name: 'CMS',
format: 'iife',
banner: banner,
});
outputs.push({
file: 'dist/cms.es.js',
name: 'CMS',
format: 'es',
banner: banner,
});
} else {
outputs.push({
file: 'examples/js/cms.js',
name: 'CMS',
format: 'iife',
banner: banner,
});
}
export default {
input: 'src/main.js',
external: ['CMS'],
output: outputs,
plugins: [
eslint(),
!production && livereload(),
resolve(),
commonjs(),
babel({ exclude: 'node_modules/**' }),
],
};