packages/@vuepress/core/lib/node/build/index.js
function compile (config) {
  return new Promise((resolve, reject) => {
    webpack(config, (err, stats) => {
      if (err) {
        return reject(err)
      }
      if (stats.hasErrors()) {
        stats.toJson().errors.forEach(err => {
          console.error(err)
        })
        reject(new Error(`Failed to compile with errors.`))
        return
      }
      if (env.isDebug && stats.hasWarnings()) {
        stats.toJson().warnings.forEach(warning => {
          console.warn(warning)
        })
      }
      resolve(stats.toJson({ modules: false }))
    })
  })
}
function compile (config) {
  return new Promise((resolve, reject) => {
    webpack(config, (err, stats) => {
      if (err) {
        return reject(err)
      }
      if (stats.hasErrors()) {
        stats.toJson().errors.forEach(err => {
          console.error(err)
        })
        reject(new Error(`Failed to compile with errors.`))
        return
      }
      if (env.isDebug && stats.hasWarnings()) {
        stats.toJson().warnings.forEach(warning => {
          console.warn(warning)
        })
      }
      resolve(stats.toJson({ modules: false }))
    })
  })
}
function compile ( config ) { return new Promise ( ( resolve , reject ) => { webpack ( config , ( err , stats ) => { if ( err ) { return reject ( err ) } if ( stats . hasErrors ( ) ) { stats . toJson ( ) . errors . forEach ( err => { console . error ( err ) } ) reject ( new Error ( ` ` ) ) return } if ( env . isDebug && stats . hasWarnings ( ) ) { stats . toJson ( ) . warnings . forEach ( warning => { console . warn ( warning ) } ) } resolve ( stats . toJson ( { modules : false } ) ) } ) } ) }
Compile a webpack application and return stats json.

@param {Object} config
@returns {Promise<Object>}
Compile a webpack application and return stats json .