@@ -7,6 +7,7 @@ const webpack = WebpackTool.webpack;
77const merge = WebpackTool . merge ;
88const utils = require ( '../utils/utils' ) ;
99const uniq = require ( 'lodash.uniq' ) ;
10+ const WebpackOptimize = require ( './optimize' ) ;
1011const Logger = require ( '../utils/logger' ) ;
1112const Adapter = require ( '../utils/adapter' ) ;
1213const zero = require ( './zero' ) ;
@@ -31,7 +32,7 @@ class Config {
3132 this . beforeCreateQueue = [ ] ;
3233 this . webpackNodeList = [
3334 'context' , 'mode' , 'target' , 'node' , 'output' , 'externals' , 'resolve' , 'watch' , 'watchOptions' , 'amd' ,
34- 'resolveLoader' , 'devServer' , 'performance' , 'module' , 'profile' , 'stats' , 'cache' , 'optimization'
35+ 'resolveLoader' , 'devServer' , 'performance' , 'module' , 'profile' , 'stats' , 'cache'
3536 ] ;
3637 this . webpackModuleRuleKeys = [
3738 'test' , 'use' , 'include' , 'exclude' , 'issuer' , 'loader' , 'oneOf' , 'options' , 'parser' , 'resource' ,
@@ -52,6 +53,7 @@ class Config {
5253 } ;
5354 this . logger = new Logger ( this . config . logger , this ) ;
5455 this . adapter = new Adapter ( this ) ;
56+ this . webpackOptimize = new WebpackOptimize ( this ) ;
5557 this . initZero ( this . config ) ;
5658 this . initEntry ( this . config ) ;
5759 this . initialize ( this . config ) ;
@@ -220,7 +222,7 @@ class Config {
220222 this . dev = true ;
221223 this . mergeConfig ( defaultConfig . devConfig ) ;
222224 }
223- this . webpackConfig . mode = this . test || this . prod ? 'production' : 'development' ;
225+ this . webpackConfig . mode = this . prod ? 'production' : 'development' ;
224226 }
225227
226228 initEntry ( config ) {
@@ -453,8 +455,14 @@ class Config {
453455 this . webpackConfig . devtool = cliDevtool ;
454456 } else if ( cliDevtool === true ) {
455457 this . webpackConfig . devtool = 'source-map' ;
456- } else if ( devtool && this . dev ) { /* istanbul ignore next */
457- this . webpackConfig . devtool = devtool ;
458+ } else if ( devtool ) { /* istanbul ignore next */
459+ if ( this . dev ) {
460+ this . webpackConfig . devtool = devtool ;
461+ } else {
462+ this . webpackConfig . devtool = false ;
463+ }
464+ } else {
465+ this . webpackConfig . devtool = false ;
458466 }
459467 }
460468
0 commit comments