@@ -5,11 +5,7 @@ const webpack = require('webpack')
5
5
const config = require ( '../config' )
6
6
const merge = require ( 'webpack-merge' )
7
7
const baseWebpackConfig = require ( './webpack.base.conf' )
8
- const CopyWebpackPlugin = require ( 'copy-webpack-plugin' )
9
- const ExtractTextPlugin = require ( 'extract-text-webpack-plugin' )
10
- const OptimizeCSSPlugin = require ( 'optimize-css-assets-webpack-plugin' )
11
- const UglifyJsPlugin = require ( 'uglifyjs-webpack-plugin' )
12
-
8
+ const prodWepbackConfig = require ( '../config/prod.webpack' )
13
9
const env = require ( '../config/prod.env' )
14
10
15
11
const webpackConfig = merge ( baseWebpackConfig , {
@@ -26,76 +22,7 @@ const webpackConfig = merge(baseWebpackConfig, {
26
22
filename : utils . assetsPath ( 'js/[name].[chunkhash:8].js' ) ,
27
23
chunkFilename : utils . assetsPath ( 'js/[id].[chunkhash:8].js' )
28
24
} ,
29
- plugins : [
30
- // http://vuejs.github.io/vue-loader/en/workflow/production.html
31
- new webpack . DefinePlugin ( {
32
- 'process.env' : env
33
- } ) ,
34
- new UglifyJsPlugin ( {
35
- uglifyOptions : {
36
- compress : {
37
- warnings : false
38
- }
39
- } ,
40
- sourceMap : config . build . productionSourceMap ,
41
- parallel : true
42
- } ) ,
43
- // extract css into its own file
44
- new ExtractTextPlugin ( {
45
- filename : utils . assetsPath ( 'css/[name].[contenthash:8].css' ) ,
46
- // Setting the following option to `false` will not extract CSS from codesplit chunks.
47
- // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
48
- // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
49
- // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
50
- allChunks : true ,
51
- } ) ,
52
- // Compress extracted CSS. We are using this plugin so that possible
53
- // duplicated CSS from different components can be deduped.
54
- new OptimizeCSSPlugin ( {
55
- cssProcessorOptions : config . build . productionSourceMap
56
- ? { safe : true , map : { inline : false } }
57
- : { safe : true }
58
- } ) ,
59
-
60
- // keep module.id stable when vendor modules does not change
61
- new webpack . HashedModuleIdsPlugin ( ) ,
62
- // enable scope hoisting
63
- new webpack . optimize . ModuleConcatenationPlugin ( ) ,
64
-
65
- // copy custom static assets
66
- new CopyWebpackPlugin ( [
67
- {
68
- from : path . resolve ( __dirname , '../static' ) ,
69
- to : config . build . assetsSubDirectory ,
70
- ignore : [ '.*' ]
71
- }
72
- ] ) ,
73
-
74
- new webpack . optimize . CommonsChunkPlugin ( {
75
- name : 'vendor' ,
76
- minChunks ( module ) {
77
- return (
78
- module . resource &&
79
- / \. j s $ / . test ( module . resource ) &&
80
- module . resource . indexOf (
81
- path . join ( __dirname , '../node_modules' )
82
- ) === 0
83
- )
84
- }
85
- } ) ,
86
-
87
- new webpack . optimize . CommonsChunkPlugin ( {
88
- name : 'manifest' ,
89
- minChunks : Infinity
90
- } ) ,
91
-
92
- new webpack . optimize . CommonsChunkPlugin ( {
93
- name : 'app' ,
94
- async : 'vendor-async' ,
95
- children : true ,
96
- minChunks : 3
97
- } )
98
- ] . concat ( utils . htmlPlugins ( ) )
25
+ plugins : prodWepbackConfig . pluginsConfig ( )
99
26
} )
100
27
101
28
if ( config . build . productionGzip ) {
0 commit comments