-
-
Notifications
You must be signed in to change notification settings - Fork 63
/
Copy pathrollup.config.js
82 lines (75 loc) · 1.9 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
/*
* @Description :
* @Author : 赵耀圣
* @Q群 : 632839661
* @Date : 2020-12-10 14:57:48
* @LastEditTime : 2021-03-12 09:31:54
* @FilePath : \cga.js\rollup.config.js
*/
// Libs
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import gzip from 'rollup-plugin-gzip';
import nodeResolve from 'rollup-plugin-node-resolve';
import path from 'path';
import { uglify } from 'rollup-plugin-uglify';
import dts from "rollup-plugin-dts";
// Read package config
const pkgConfig = require('./package.json');
// Constants
const DIST = process.env.DIST || false;
const MIN = process.env.MIN || false;
const banner = `/**
* https://github.com/yszhao91/cga.js
*CGA Lib |cga.js |alex Zhao | Zhao yaosheng
*@license free for all
*/`;
const plugins = [
babel({
exclude: 'node_modules/**'
}),
nodeResolve({
browser: true
}),
commonjs({
sourceMap: false,
// namedExports: {
// 'node_modules/eventemitter2/lib/eventemitter2.js': ['EventEmitter2']
// }
// 'namedExports': {
// './dist/src/index.js': ['__moduleExports']
// }
})
];
if (MIN) {
plugins.push(uglify({
output: {
comments: /@license/
}
}));
plugins.push(gzip());
}
export default [
{
input: path.join('dist', 'index.js'),
external: ['lodash'],
plugins: plugins,
output: {
file: path.join(DIST ? 'dist' : 'build', '@xort_cga' + (MIN ? '.min' : '') + '.js'),
format: 'umd',
// format: 'umd',
name: 'cga',
banner: banner,
globals: {
lodash: '_'
}
}
},
{
input: "dist/index.d.ts",
output: [{
file: "build/cga.d.ts", format: "es",
name: 'cga'
}],
plugins: [dts()],
}]