webpack 效率及性能提升
1.//比UglifyJsPlugin压缩给力1倍的压缩工具
var ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin') new ParallelUglifyPlugin({ cacheDir: '.cache/', uglifyJS: { output: { comments: false }, compress: { warnings: false } } }),
2.
/*
*myhappy的加速度并不显著,可能需要电脑配置.但是命中cache后速度会翻倍.
*主要的时间消耗是在js的转换上,就是babel-loader js,大概要23秒.
*压缩时间大概是10秒.
*https://github.com/amireh/happypack
*http://taobaofed.org/blog/2016/12/08/happypack-source-code-analysis/
*/
var myHappyPack = new HappyPack({ loaders: [{ // id: 'js', loader: 'babel-loader', threadPool: happyThreadPool, options: { cacheDirectory: true, } }] })
然后加入到plugins:[]里
3.推荐的tool,效率与实用平衡考虑
//http://www.cnblogs.com/imwtr/p/7801973.html
devtool: isdev ? "cheap-module-eval-source-map" : "cheap-source-map",
4.如果用到将公用js 合并 至 CommonsChunkPlugin ,则开发环境的vendor引用应该放在最前面,否则会报webpackjsonp错误.