kdayun-compnent-develop/kdayun-compnent-pack/dist/libs/echarts/zrender/build/config.js

48 lines
1.1 KiB
JavaScript
Raw Normal View History

2022-02-19 20:37:32 +08:00
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')]
}
};
};