- plugins: [
- new webpack.DefinePlugin({
- 'process.env': env
- }),
- new UglifyJsPlugin({
- uglifyOptions: {
- compress: {
- warnings: false
- }
- },
- sourceMap: config.build.productionSourceMap,
- parallel: true
- }),
- new ExtractTextPlugin({
- filename: utils.assetsPath('CSS/[name].[contenthash].css'),
- allChunks: true,
- }),
- new OptimizeCSSPlugin({
- cssProcessorOptions: config.build.productionSourceMap
- ? {
- safe: true, map: {
- inline: false
- }
- }
- : {
- safe: true
- }
- }),
- new webpack.HashedModuleIdsPlugin(),
- new webpack.optimize.ModuleConcatenationPlugin(),
- new webpack.optimize.CommonsChunkPlugin({
- name: 'vendor',
- minChunks (module) {
- return (
- module.resource &&
- /.JS$/.test(module.resource) &&
- module.resource.indexOf(
- path.join(__dirname, '../node_modules')
- ) === 0
- )
- }
- }),
- new webpack.optimize.CommonsChunkPlugin({
- name: 'manifest',
- minChunks: Infinity
- }),
- new webpack.optimize.CommonsChunkPlugin({
- name: 'app',
- async: 'vendor-async',
- children: true,
- minChunks: 3
- }),
- new CopyWebpackPlugin([
- {
- from: path.resolve(__dirname, '../static'),
- to: config.build.assetsSubDirectory,
- ignore: ['.*']
- }
- ])
- ].concat(utils.htmlPlugin())
并删除下述代码:
来源: http://www.jianshu.com/p/1ca08f16bbb2