config.js
1.08 KB
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
const uglifyPlugin = require('rollup-plugin-uglify');
const {resolve} = require('path');
// Based on echarts/
function getPath(relativePath) {
return resolve(__dirname, '../', relativePath);
}
/**
* @param {boolean} [min=false]
*/
function getPlugins(min) {
let plugins = [];
min && plugins.push(uglifyPlugin({
compress: {
// Eliminate __DEV__ code.
'global_defs': {
__DEV__: true
}
}
}));
return plugins;
}
/**
* @param {boolean} [min=false]
*/
exports.create = function (min) {
let postfixMin = min ? '.min' : '';
return {
plugins: getPlugins(min),
input: getPath(`./zrender.all.js`),
legacy: true, // Support IE8-
output: {
name: 'zrender',
format: 'umd',
legacy: true, // Must be declared both in inputOptions and outputOptions.
sourcemap: !min,
file: getPath(`dist/zrender${postfixMin}.js`)
},
watch: {
include: [getPath('./src/**'), getPath('./zrender*.js')]
}
};
};