code: function readWebpackConfig() {
  
    try {
  
      assert(
        existsSync( appWebpackDevConfigFile ),
        `File ${WEBPACK_DEV_CONFIG} is not exsit.`
      );
  
      const wpConfig = loadConfig( appWebpackDevConfigFile );
  
      // 加载插件， 插件函数可能要修改配置
      if ( is.Function( wpConfig.plugins )) {
        wpConfig.plugins = wpConfig.plugins( wpConfig );
      }
  
      // 必须是个数组
      if ( !is.Array( wpConfig.plugins )) {
        wpConfig.plugins = [wpConfig.plugins];
      }
  
      // 多层函数扁平化，可能是多个生成插件的函数组合可能会形成嵌套数组，所以要扁平化
      wpConfig.plugins = flatten( wpConfig.plugins.map(( plugin ) => {
        return is.Function( plugin ) ? plugin( wpConfig ) : plugin;
      }));
  
      return wpConfig;
    } catch ( err ) {
      print();
      print( chalk.red( `Failed to read [${WEBPACK_DEV_CONFIG}].` ));
      print();
      print( err.toString());
      print();
      throw err;
    }
  }
docs: 加载 webpack 配置