1+ /** 
2+  * Created by gubaoer on 17/5/10. 
3+  */ 
4+ 
5+ process . env . NODE_ENV  =  'production' ; 
6+ var  webpack  =  require ( 'webpack' ) ; 
7+ var  merge  =  require ( 'webpack-merge' ) ; 
8+ var  HtmlWebpackPlugin  =  require ( 'html-webpack-plugin' ) ; 
9+ var  ExtractTextPlugin  =  require ( 'extract-text-webpack-plugin' ) ; 
10+ var  path  =  require ( 'path' ) ; 
11+ var  baseWebpackConfig  =  require ( './webpack.base.config.js' ) ; 
12+ var  utils  =  require ( './utils' ) ; 
13+ var  config  =  require ( './config' ) ; 
14+ 
15+ module . exports  =  merge ( baseWebpackConfig ,  { 
16+     output : { 
17+         path : config . prod . outputPath , 
18+         publicPath : config . prod . outputPublicPath , 
19+         filename : 'js/[name].js?[chunkhash]' 
20+     } , 
21+     module : { 
22+         rules : utils . styleLoaders ( ) 
23+     } , 
24+     plugins : [ 
25+         new  webpack . DefinePlugin ( { 
26+             'process.env.NODE_ENV' : '"production"' 
27+         } ) , 
28+         new  webpack . optimize . UglifyJsPlugin ( ) , 
29+         new  ExtractTextPlugin ( { 
30+             filename : "css/style.css?[contenthash:8]" 
31+         } ) , 
32+         new  webpack . optimize . CommonsChunkPlugin ( { 
33+             name : 'vendor' , 
34+             minChunks : function  ( module ,  count )  { 
35+                 return  module . resource  &&  / \. j s $ / . test ( module . resource )  &&  module . resource . indexOf ( path . join ( __dirname ,  '../node_modules' ) )  ===  0 
36+             } 
37+         } ) , 
38+         new  webpack . optimize . CommonsChunkPlugin ( { 
39+             name : 'manifest' , 
40+             chunks : [ 'vendor' ] 
41+         } ) , 
42+         new  HtmlWebpackPlugin ( { 
43+             filename : 'index.html' , 
44+             template : 'index.tpl.html' , 
45+             inject : true 
46+         } ) 
47+     ] 
48+ } ) 
0 commit comments