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
+7 -1
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;
+4 -4
View File
@@ -1,7 +1,7 @@
var webpack = require('webpack');
var merge = require('webpack-merge');
var path = require('path');
var devConfig = require('./webpack.config.dev.js');
const webpack = require('webpack');
const merge = require('webpack-merge');
const path = require('path');
const devConfig = require('./webpack.config.dev.js');
module.exports = merge(devConfig, {
output: {