11var webpack = require ( 'webpack' ) ;
22var ExtractTextPlugin = require ( "extract-text-webpack-plugin" ) ;
3+ var HtmlWepackPlugin = require ( 'html-webpack-plugin' ) ;
34
5+ // basic configurations
46module . exports = {
57 entry : './src/main.js' ,
68 output : {
7- path : './dist/ ' ,
8- publicPath : 'dist /' ,
9- filename : 'bundle.js'
9+ path : './dist' ,
10+ publicPath : '/' ,
11+ filename : 'static/js/ bundle.js'
1012 } ,
1113 resolve : {
1214 extensions : [ '' , '.js' , '.vue' ]
@@ -60,10 +62,11 @@ module.exports = {
6062 }
6163 } ,
6264 plugins : [
63- new ExtractTextPlugin ( "bundle.css" )
65+ new ExtractTextPlugin ( "static/css/ bundle.css" )
6466 ]
6567} ;
6668
69+ // production configurations
6770if ( process . env . NODE_ENV === 'production' ) {
6871 module . exports . plugins = module . exports . plugins . concat ( [
6972 new webpack . DefinePlugin ( {
@@ -76,12 +79,30 @@ if (process.env.NODE_ENV === 'production') {
7679 warnings : false
7780 }
7881 } ) ,
79- new webpack . optimize . OccurenceOrderPlugin ( )
82+ new webpack . optimize . OccurenceOrderPlugin ( ) ,
83+ new HtmlWepackPlugin ( {
84+ filename : 'index.html' ,
85+ template : 'index.html' ,
86+ minify : {
87+ removeComments : true ,
88+ collapseWhitespace : true
89+ }
90+ } )
8091 ] ) ;
8192
8293 module . exports . vue . autoprefixer = {
8394 browsers : [ 'last 2 versions' ]
8495 }
8596} else {
97+ // development configurations
98+ module . exports . plugins = module . exports . plugins . concat ( [
99+ new HtmlWepackPlugin ( {
100+ filename : 'index.html' ,
101+ template : 'index.html'
102+ } )
103+ ] ) ;
104+ module . exports . devServer = {
105+ contentBase : './dist'
106+ } ;
86107 module . exports . devtool = '#source-map' ;
87108}
0 commit comments