UNPKG

echarts

Version:

A powerful charting and visualization library for browser

43 lines (38 loc) 1.28 kB
var PROD = process.argv.indexOf('-p') >= 0; var webpack = require('webpack'); var RawSource = require("webpack-core/lib/RawSource"); var mangleString = require('./build/mangleString'); function MangleStringPlugin() { } MangleStringPlugin.prototype.apply = function (compiler) { compiler.plugin('compilation', function (compilation) { compilation.templatesPlugin('render-with-entry', function(source , chunk, hash) { console.log('1'); var code = mangleString(source.source()); return new RawSource(code); }); }); }; module.exports = { entry: { // 'echarts': __dirname + '/index.js', 'echarts.simple': __dirname + '/index.simple.js', // 'echarts.common': __dirname + '/index.common.js' }, output: { // libraryTarget: 'umd', // library: 'echarts', path: __dirname + '/dist', filename: PROD ? '[name].min.js' : '[name].js' }, plugins: PROD ? [ new MangleStringPlugin(), new webpack.LibraryTemplatePlugin('echarts', 'umd', {}), new webpack.optimize.UglifyJsPlugin({ minimize: true, sourceMap: false }) ] : [ new webpack.LibraryTemplatePlugin('echarts', 'umd', {}) ] };