//TODO non-watch transpiler for production builds transpiler.watch({ // watch options: }, function(err, stats) { if(err){ console.warn(err); } var jsonStats = stats.toJson(); if(jsonStats.errors.length > 0) return handleCompileError(jsonStats.errors); if(jsonStats.warnings.length > 0) return handleCompileWarn(jsonStats.warnings) console.log("done compiling"); });
const runWebpackCompiler = (webpackConfig) => new Promise((resolve, reject) => { webpack(webpackConfig).run((err, stats) => { if (err) { logger.error('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() if (jsonStats.errors.length > 0) { logger.error('Webpack compiler encountered errors.') logger.log(jsonStats.errors.join('\n')) return reject(new Error('Webpack compiler encountered errors')) } else if (jsonStats.warnings.length > 0) { logger.warn('Webpack compiler encountered warnings.') logger.log(jsonStats.warnings.join('\n')) } resolve(stats) }) })
// Wrapper around webpack to promisify its compiler and supply friendly logging const webpackCompiler = (webpackConfig) => new Promise((resolve, reject) => { const compiler = webpack(webpackConfig) compiler.run((err, stats) => { if (err) { debug('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() debug('Webpack compile completed.') debug(stats.toString(project.compiler_stats)) if (jsonStats.errors.length > 0) { debug('Webpack compiler encountered errors.') debug(jsonStats.errors.join('\n')) return reject(new Error('Webpack compiler encountered errors')) } else if (jsonStats.warnings.length > 0) { debug('Webpack compiler encountered warnings.') debug(jsonStats.warnings.join('\n')) } else { debug('No errors or warnings encountered.') } resolve(jsonStats) }) })
function _webpackTask(config, cb) { webpack(config, function(err, stats) { if (err) { return cb(err); } var jsonStats = stats.toJson(); if (jsonStats.errors.length > 0) { return cb(jsonStats.errors); } if (jsonStats.warnings.length > 0) { gutil.log(gutil.colors.yellow(jsonStats.warnings)); } cb(); }); }
function webpackCompiler (webpackConfig, statsFormat) { statsFormat = statsFormat || config.compiler_stats; return new Promise((resolve, reject) => { const compiler = webpack(webpackConfig); compiler.run((err, stats) => { if (err) { debug('Webpack compiler encountered a fatal error.', err); return reject(err); } const jsonStats = stats.toJson(); debug('Webpack compile completed.'); debug(stats.toString(statsFormat)); if (jsonStats.errors.length > 0) { debug('Webpack compiler encountered errors.'); debug(jsonStats.errors.join('\n')); return reject(new Error('Webpack compiler encountered errors')); } else if (jsonStats.warnings.length > 0) { debug('Webpack compiler encountered warnings.'); debug(jsonStats.warnings.join('\n')); } else { debug('No errors or warnings encountered.'); } resolve(jsonStats); }); }); }
const runWebpackCompiler = (webpackConfig) => new Promise((resolve, reject) => { webpack(webpackConfig).run((err, stats) => { if (err) { logger.error('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() if (jsonStats.errors.length > 0) { logger.error('Webpack compiler encountered errors.') logger.log(jsonStats.errors.join('\n')) return reject(new Error('Webpack compiler encountered errors')) } else if (jsonStats.warnings.length > 0) { logger.warn('Webpack compiler encountered warnings.') logger.log(jsonStats.warnings.join('\n')) } resolve(stats) }) })
const runWebpackCompiler = (webpackConfig) => new Promise((resolve, reject) => { webpack(webpackConfig).run((err, stats) => { if (err) { logger.error('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() if (jsonStats.errors.length > 0) { logger.error('Webpack compiler encountered errors.') logger.log(jsonStats.errors.join('\n')) return reject(new Error('Webpack compiler encountered errors')) } else if (jsonStats.warnings.length > 0) { logger.warn('Webpack compiler encountered warnings.') logger.log(jsonStats.warnings.join('\n')) } resolve(stats) }) })
// Wrapper around webpack to promisify its compiler and supply friendly logging const webpackCompiler = (webpackConfig) => new Promise((resolve, reject) => { const compiler = webpack(webpackConfig) compiler.run((err, stats) => { if (err) { debug('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() debug('Webpack compile completed.') debug(stats.toString(project.compiler_stats)) if (jsonStats.errors.length > 0) { debug('Webpack compiler encountered errors.') debug(jsonStats.errors.join('\n')) return reject(new Error('Webpack compiler encountered errors')) } else if (jsonStats.warnings.length > 0) { debug('Webpack compiler encountered warnings.') debug(jsonStats.warnings.join('\n')) } else { debug('No errors or warnings encountered.') } resolve(jsonStats) }) })
// Wrapper around webpack to promisify its compiler and supply friendly logging const webpackCompiler = (webpackConfig) => new Promise((resolve, reject) => { const compiler = webpack(webpackConfig) compiler.run((err, stats) => { if (err) { debug('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() debug('Webpack compile completed.') debug(stats.toString(project.compiler_stats)) if (jsonStats.errors.length > 0) { debug('Webpack compiler encountered errors.') debug(jsonStats.errors.join('\n')) return reject(new Error('Webpack compiler encountered errors')) } else if (jsonStats.warnings.length > 0) { debug('Webpack compiler encountered warnings.') debug(jsonStats.warnings.join('\n')) } else { debug('No errors or warnings encountered.') } resolve(jsonStats) }) })
// Wrapper around webpack to promisify its compiler and supply friendly logging const webpackCompiler = (webpackConfig) => new Promise((resolve, reject) => { const compiler = webpack(webpackConfig) compiler.run((err, stats) => { if (err) { debug('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() debug('Webpack compile completed.') debug(stats.toString(project.compiler_stats)) if (jsonStats.errors.length > 0) { debug('Webpack compiler encountered errors.') debug(jsonStats.errors.join('\n')) return reject(new Error('Webpack compiler encountered errors')) } else if (jsonStats.warnings.length > 0) { debug('Webpack compiler encountered warnings.') debug(jsonStats.warnings.join('\n')) } else { debug('No errors or warnings encountered.') } resolve(jsonStats) }) })
// Wrapper around webpack to promisify its compiler and supply friendly logging const webpackCompiler = (webpackConfig) => new Promise((resolve, reject) => { const compiler = webpack(webpackConfig) compiler.run((err, stats) => { if (err) { debug('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() debug('Webpack compile completed.') debug(stats.toString(project.compiler_stats)) if (jsonStats.errors.length > 0) { debug('Webpack compiler encountered errors.') debug(jsonStats.errors.join('\n')) return reject(new Error('Webpack compiler encountered errors')) } else if (jsonStats.warnings.length > 0) { debug('Webpack compiler encountered warnings.') debug(jsonStats.warnings.join('\n')) } else { debug('No errors or warnings encountered.') } resolve(jsonStats) }) })
// Wrapper around webpack to promisify its compiler and supply friendly logging const webpackCompiler = (webpackConfig) => new Promise((resolve, reject) => { const compiler = webpack(webpackConfig) compiler.run((err, stats) => { if (err) { debug('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() debug('Webpack compile completed.') debug(stats.toString(project.compiler_stats)) if (jsonStats.errors.length > 0) { debug('Webpack compiler encountered errors.') debug(jsonStats.errors.join('\n')) return reject(new Error('Webpack compiler encountered errors')) } else if (jsonStats.warnings.length > 0) { debug('Webpack compiler encountered warnings.') debug(jsonStats.warnings.join('\n')) } else { debug('No errors or warnings encountered.') } resolve(jsonStats) }) })
// Wrapper around webpack to promisify its compiler and supply friendly logging const webpackCompiler = (webpackConfig) => new Promise((resolve, reject) => { const compiler = webpack(webpackConfig) compiler.run((err, stats) => { if (err) { debug('Webpack compiler encountered a fatal error.', err) return reject(err) } const jsonStats = stats.toJson() debug('Webpack compile completed.') debug(stats.toString(project.compiler_stats)) if (jsonStats.errors.length > 0) { debug('Webpack compiler encountered errors.') debug(jsonStats.errors.join('\n')) return reject(new Error('Webpack compiler encountered errors')) } else if (jsonStats.warnings.length > 0) { debug('Webpack compiler encountered warnings.') debug(jsonStats.warnings.join('\n')) } else { debug('No errors or warnings encountered.') } resolve(jsonStats) }) })