compiler.watch(opts.watchOpts, (err, stats) => { if (err) return this.console.error(err); if (stats.hasErrors()) { let json = stats.toJson(); this.console.error(json.errors.join(os.EOL + os.EOL)); } this.console.log('实时编译:', Date.now()); next(); });
compiler.run((err, stats) => { if (err) { console.error(err.stack || err); if (err.details) { this.console.error(err.details); } return; } const info = stats.toJson(); if (stats.hasErrors()) { return this.console.error(info.errors); } this.console.info('完成'); next(); });
compiler.run((err, stats) => { if (err) return this.console.error('error:', err); let json = stats.toJson(); if (stats.hasErrors()) { return this.console.error(json.errors.join(os.EOL + os.EOL)); } this.console.log(''); utils.each(json.assetsByChunkName, (chunkName, assets) => { this.console.info(`Chunk: ${chunkName}`); if (utils.isArray(assets)) { this.console.log(assets.map(name => ` file: ${name}`).join(os.EOL)); } this.console.log(''); }); this.console.info('完成'); next(); });
//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(); }); }
compiler.watch(opts.watchOpts, (err, stats) => { if (err) return this.console.error(err); if (stats.hasErrors()) { let json = stats.toJson(); this.console.error(json.errors.join(os.EOL + os.EOL)); } this.console.log('实时编译:', Date.now()); next(); });
compiler.run((err, stats) => { if (err) { console.error(err.stack || err); if (err.details) { this.console.error(err.details); } return; } const info = stats.toJson(); if (stats.hasErrors()) { return this.console.error(info.errors); } this.console.info('完成'); next(); });
compiler.run((err, stats) => { if (err) return this.console.error('error:', err); let json = stats.toJson(); if (stats.hasErrors()) { return this.console.error(json.errors.join(os.EOL + os.EOL)); } this.console.log(''); utils.each(json.assetsByChunkName, (chunkName, assets) => { this.console.info(`Chunk: ${chunkName}`); if (utils.isArray(assets)) { this.console.log(assets.map(name => ` file: ${name}`).join(os.EOL)); } this.console.log(''); }); this.console.info('完成'); next(); });
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) }) })