@@ -76,20 +76,6 @@ export default class InitGenerator extends Generator {
7676 tooltip . splitChunks ( )
7777 ) ;
7878
79- if ( ! this . usingDefaults ) {
80- this . dependencies . push ( "terser-webpack-plugin" ) ;
81- this . configuration . config . topScope . push (
82- tooltip . terser ( ) ,
83- "const TerserPlugin = require('terser-webpack-plugin');" ,
84- "\n"
85- ) ;
86- } else {
87- this . dependencies . push ( "webpack-dev-server" ) ;
88- this . configuration . config . webpackOptions . devServer = {
89- open : true
90- } ;
91- }
92-
9379 ( this . configuration . config . webpackOptions . plugins as string [ ] ) . push ( "new webpack.ProgressPlugin()" ) ;
9480 }
9581
@@ -151,7 +137,8 @@ export default class InitGenerator extends Generator {
151137 } ;
152138 } else {
153139 this . configuration . config . webpackOptions . output = {
154- filename : "'bundle.js'"
140+ filename : "'bundle.js'" ,
141+ path : `path.resolve(__dirname, '${ outputDir } ')`
155142 } ;
156143 }
157144
@@ -231,8 +218,21 @@ export default class InitGenerator extends Generator {
231218 ( this . configuration . config . webpackOptions . plugins as string [ ] ) . push ( `new ${ htmlwebpackPlugin } ()` ) ;
232219 }
233220
234- let optimizationConfig = getDefaultOptimization ( ! this . usingDefaults ) ;
235- this . configuration . config . webpackOptions . optimization = optimizationConfig ;
221+ if ( ! this . usingDefaults ) {
222+ this . dependencies . push ( "webpack-dev-server" ) ;
223+ this . configuration . config . webpackOptions . devServer = {
224+ open : true
225+ } ;
226+ } else {
227+ this . dependencies . push ( "terser-webpack-plugin" ) ;
228+ this . configuration . config . topScope . push (
229+ tooltip . terser ( ) ,
230+ "const TerserPlugin = require('terser-webpack-plugin');" ,
231+ "\n"
232+ ) ;
233+ }
234+ this . configuration . config . webpackOptions . optimization = getDefaultOptimization ( this . usingDefaults ) ;
235+ this . configuration . config . webpackOptions . mode = this . usingDefaults ? "'development'" : "'production'" ;
236236
237237 done ( ) ;
238238 }
0 commit comments