use bundle analyzer plugin to analyze budle size

This commit is contained in:
陈嘉涵
2017-09-29 16:18:42 +08:00
parent b539e9b22f
commit 493b481aa7
4 changed files with 244 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
const webpack = require('webpack');
const config = require('./webpack.config.dev.js');
const isMinify = process.argv.indexOf('-p') !== -1;
const isMinify = process.argv.indexOf('-p') !== -1;
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
config.entry = {
'vant': './packages/index.js'
@@ -39,6 +40,11 @@ config.plugins = [
new webpack.optimize.ModuleConcatenationPlugin()
];
// analyze bundle size if need
// if (isMinify) {
// config.plugins.push(new BundleAnalyzerPlugin());
// }
delete config.devtool;
module.exports = config;