return reject(err); const messages = formatWebpackMessages(stats.toJson({}, true)); if (messages.errors.length) { return reject(new Error(messages.errors.join('\n\n')));
} else { messages = formatWebpackMessages( stats.toJson({ all: false, warnings: true, errors: true }) );
} else { messages = formatWebpackMessages( stats.toJson({ all: false, warnings: true, errors: true }) );
compiler.watch(opts.watchOpts, (err, stats) => { if (err) return this.console.error(err); let json = stats.toJson({}, true); printErrors.call(this, json); if (this.emit) this.emit('webpack.stats', stats); printStats.call(this, json); 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.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) 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(); });
compiler.run((err, stats) => { if (err) throw err; let json = stats.toJson({}, true); printErrors.call(this, json); if (this.emit) this.emit('webpack.stats', stats); 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(''); }); printStats.call(this, json); this.console.info('完成'); next(); });
} else { messages = formatWebpackMessages( stats.toJson({ all: false, warnings: true, errors: true }) );
} else { messages = formatWebpackMessages( stats.toJson({ all: false, warnings: true, errors: true }) );
compiler.watch(opts.watchOpts, (err, stats) => { if (err) return this.console.error(err); let json = stats.toJson({}, true); printErrors.call(this, json); if (this.emit) this.emit('webpack.stats', stats); printStats.call(this, json); this.console.log('实时编译:', Date.now()); next(); });
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(); });
compiler.run((err, stats) => { if (err) throw err; let json = stats.toJson({}, true); printErrors.call(this, json); if (this.emit) this.emit('webpack.stats', stats); 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(''); }); printStats.call(this, json); this.console.info('完成'); next(); });