@@ -3,7 +3,6 @@ const { resolve, extname } = require('path');
33const webpackMerge = require ( 'webpack-merge' ) ;
44const { extensions, jsVariants } = require ( 'interpret' ) ;
55const rechoir = require ( 'rechoir' ) ;
6- const ConfigError = require ( '../utils/errors/ConfigError' ) ;
76const logger = require ( '../utils/logger' ) ;
87
98// Order defines the priority, in increasing order
@@ -92,7 +91,8 @@ const resolveConfigFiles = async (args) => {
9291 const configFiles = getConfigInfoFromFileName ( configPath ) ;
9392
9493 if ( ! configFiles . length ) {
95- throw new ConfigError ( `The specified config file doesn't exist in ${ configPath } ` ) ;
94+ logger . error ( `The specified config file doesn't exist in ${ configPath } ` ) ;
95+ process . exit ( 2 ) ;
9696 }
9797
9898 const foundConfig = configFiles [ 0 ] ;
@@ -230,12 +230,12 @@ const resolveConfigMerging = async (args) => {
230230 // either by passing multiple configs by flags or passing a
231231 // single config exporting an array
232232 if ( ! Array . isArray ( configOptions ) ) {
233- throw new ConfigError ( 'Atleast two configurations are required for merge.' , 'MergeError' ) ;
233+ logger . error ( 'At least two configurations are required for merge.' ) ;
234+ process . exit ( 2 ) ;
234235 }
235236
236237 // We return a single config object which is passed to the compiler
237- const mergedOptions = configOptions . reduce ( ( currentConfig , mergedConfig ) => webpackMerge ( currentConfig , mergedConfig ) , { } ) ;
238- opts [ 'options' ] = mergedOptions ;
238+ opts [ 'options' ] = configOptions . reduce ( ( currentConfig , mergedConfig ) => webpackMerge ( currentConfig , mergedConfig ) , { } ) ;
239239 }
240240} ;
241241
0 commit comments