@@ -9,41 +9,43 @@ const projectRoot = path.join(__dirname, "../");
99interface IWebpackEnv {
1010 devServerHost : string ;
1111 devServerPort : string ;
12+ open : boolean ;
1213 production : boolean ;
1314 watch : boolean ;
1415}
1516
1617const defaultEnvironment : IWebpackEnv = {
1718 devServerHost : "localhost" ,
1819 devServerPort : "3013" ,
20+ open : false ,
1921 production : false ,
20- watch : false
22+ watch : false ,
2123} ;
2224
2325const getConfig = ( env : IWebpackEnv ) : webpack . Configuration => ( {
2426 context : projectRoot ,
25- ...( process . argv . some ( arg => arg . includes ( "webpack-dev-server" ) )
27+ ...( process . argv . some ( ( arg ) => arg . includes ( "webpack-dev-server" ) )
2628 ? {
2729 devServer : {
2830 contentBase : "./dist" ,
2931 host : env . devServerHost ,
3032 hot : true ,
31- open : true ,
33+ open : env . open ,
3234 port : parseInt ( env . devServerPort , 10 ) ,
33- publicPath : "/"
34- }
35+ publicPath : "/" ,
36+ } ,
3537 }
3638 : { } ) ,
3739 // devtool: env.production ? "source-map" : "cheap-module-eval-source-map",
3840 devtool : "cheap-module-eval-source-map" ,
3941 entry : [
40- ...( process . argv . some ( arg => arg . includes ( "webpack-dev-server" ) )
42+ ...( process . argv . some ( ( arg ) => arg . includes ( "webpack-dev-server" ) )
4143 ? [
4244 `webpack-dev-server/client?http://${ env . devServerHost } :${ env . devServerPort } ` ,
43- "webpack/hot/dev-server"
45+ "webpack/hot/dev-server" ,
4446 ]
4547 : [ ] ) ,
46- "./src/index.ts"
48+ "./src/index.ts" ,
4749 ] ,
4850 mode : env . production ? "production" : "development" ,
4951 module : {
@@ -57,10 +59,10 @@ const getConfig = (env: IWebpackEnv): webpack.Configuration => ({
5759 // other preprocessors should work out of the box, no loader config like this necessary.
5860 sass : "vue-style-loader!css-loader!sass-loader?indentedSyntax" ,
5961 scss : "vue-style-loader!css-loader!sass-loader" ,
60- ts : "babel-loader!ts-loader"
61- }
62+ ts : "babel-loader!ts-loader" ,
63+ } ,
6264 } ,
63- test : / \. v u e $ /
65+ test : / \. v u e $ / ,
6466 } ,
6567 {
6668 exclude : / n o d e _ m o d u l e s / ,
@@ -69,9 +71,9 @@ const getConfig = (env: IWebpackEnv): webpack.Configuration => ({
6971 loader : "babel-loader" ,
7072 options : {
7173 babelrc : true ,
72- configFile : "./.babelrc"
73- }
74- }
74+ configFile : "./.babelrc" ,
75+ } ,
76+ } ,
7577 } ,
7678 {
7779 exclude : / n o d e _ m o d u l e s / ,
@@ -80,31 +82,31 @@ const getConfig = (env: IWebpackEnv): webpack.Configuration => ({
8082 loader : "ts-loader" ,
8183 options : {
8284 appendTsSuffixTo : [ / \. v u e $ / ] ,
83- configFile : "tsconfig.json"
84- }
85- }
85+ configFile : "tsconfig.json" ,
86+ } ,
87+ } ,
8688 } ,
8789 {
8890 test : / \. c s s $ / ,
89- use : [ "vue-style-loader" , "css-loader" ]
90- }
91- ]
91+ use : [ "vue-style-loader" , "css-loader" ] ,
92+ } ,
93+ ] ,
9294 } ,
9395 output : {
9496 filename : "app.js" ,
95- path : path . resolve ( projectRoot , "dist" )
97+ path : path . resolve ( projectRoot , "dist" ) ,
9698 } ,
9799 plugins : [
98100 new VueLoaderPlugin ( ) ,
99- new HtmlWebpackPlugin ( { template : "./src/index.html" } )
101+ new HtmlWebpackPlugin ( { template : "./src/index.html" } ) ,
100102 ] ,
101103 resolve : {
102104 alias : {
103- vue$ : "vue/dist/vue.esm.js"
105+ vue$ : "vue/dist/vue.esm.js" ,
104106 } ,
105- extensions : [ ".ts" , ".js" , ".vue" , ".json" ]
107+ extensions : [ ".ts" , ".js" , ".vue" , ".json" ] ,
106108 } ,
107- watch : env . watch
109+ watch : env . watch ,
108110} ) ;
109111
110112export default (
0 commit comments