@@ -8,7 +8,7 @@ const allowedEnvs = ['dev', 'dist', 'test'];
88
99// Set the correct environment
1010var env ;
11- if ( args . _ . length > 0 && args . _ . indexOf ( 'start' ) !== - 1 ) {
11+ if ( args . _ . length > 0 && args . _ . indexOf ( 'start' ) !== - 1 ) {
1212 env = 'test' ;
1313} else if ( args . env ) {
1414 env = args . env ;
@@ -17,14 +17,6 @@ if(args._.length > 0 && args._.indexOf('start') !== -1) {
1717}
1818process . env . REACT_WEBPACK_ENV = env ;
1919
20- // Get available configurations
21- const configs = {
22- base : require ( path . join ( __dirname , 'cfg/base' ) ) ,
23- dev : require ( path . join ( __dirname , 'cfg/dev' ) ) ,
24- dist : require ( path . join ( __dirname , 'cfg/dist' ) ) ,
25- test : require ( path . join ( __dirname , 'cfg/test' ) )
26- } ;
27-
2820/**
2921 * Build the webpack configuration
3022 * @param {String } wantedEnv The wanted environment
@@ -33,7 +25,8 @@ const configs = {
3325function buildConfig ( wantedEnv ) {
3426 let isValid = wantedEnv && wantedEnv . length > 0 && allowedEnvs . indexOf ( wantedEnv ) !== - 1 ;
3527 let validEnv = isValid ? wantedEnv : 'dev' ;
36- return configs [ validEnv ] ;
28+ let config = require ( path . join ( __dirname , 'cfg/' + validEnv ) ) ;
29+ return config ;
3730}
3831
3932module . exports = buildConfig ( env ) ;
0 commit comments