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(); });
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { if (err) throw err webpack(webpackConfig, (err, stats) => { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. chunks: false, chunkModules: false }) + '\n\n') if (stats.hasErrors()) { console.log(chalk.red(' Build failed with errors.\n')) process.exit(1) } console.log(chalk.cyan(' Build complete.\n')) console.log(chalk.yellow( ' Tip: built files are meant to be served over an HTTP server.\n' + ' Opening index.html over file:// won\'t work.\n' )) }) })
clipped.hook('watch') .add('default', clipped => new Promise((resolve, reject) => { const webpackInstance = getWebpackInstance() webpackInstance.watch({}, (err, stats) => { if (err || stats.hasErrors()) { console.error(err) } console.log(stats.toString({ chunks: false, // Makes the build much quieter colors: true // Shows colors in the console })) }) }) )
compiler.run((err, stats) => { if (err || stats.hasErrors()) { console.log(stats.toString({ colors: true })); Console.error("There was an error compiling, review above"); return; } Console.success("Your code compiled successfully, proceding to deploy..."); ghpages.publish('public', function(err) { if(err){ console.error(err); Console.error("There was an error publishing your website"); return; } //https://<github_user>.github.io/<repository-name> Console.success(`Your website has been deployed successfully here: https://${repository["owner"]}.github.io/${repository["name"]}/`); }); });
api.hook('watch') .add('webpack', api => new Promise((resolve, reject) => { const webpackInstance = webpack(api.config.webpack.toJSON()) webpackInstance.watch({}, (err, stats) => { if (err || stats.hasErrors()) { console.error(err) } api.print(stats.toString({ chunks: false, // Makes the build much quieter colors: true // Shows colors in the console })) }) }) )
serverCompiler.watch({ // watchOptions 示例 aggregateTimeout: 300, poll: undefined }, (err, stats) => { // 在这里打印 watch/build 结果... console.log(chalk.bgGreen('\n √ Server compile done ') + '\n'); if (err) { console.error(err); return; } if(stats.hasErrors()){ console.log(chalk.red('\n ✖️ Server compile Error ') + '\n'); console.log(stats.toString({ chunks: false, // 使构建过程更静默无输出 colors: true // 在控制台展示颜色 })); } })
compiler.run((err, stats) => { if (err) { console.error(err.stack || err); if (err.details) console.error(err.details); process.exit(1); } const summary = stats.toString({chunks: false, colors: true}); process.stdout.write(minimal(summary)); if (stats.hasErrors()) { process.exit(2); } });
clipped.hook('build') .add('default', clipped => new Promise((resolve, reject) => { process.env.NODE_ENV = 'production' const webpackInstance = getWebpackInstance() webpackInstance.run((err, stats = {}) => { if (err || stats.hasErrors()) { console.error(err) reject(err) } console.log(stats.toString({ chunks: false, // Makes the build much quieter colors: true // Shows colors in the console })) resolve() }) }) )
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(); });
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { if (err) throw err webpack(webpackConfig, (err, stats) => { spinner.stop() if (err) throw err process.stdout.write(stats.toString({ colors: true, modules: false, children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. chunks: false, chunkModules: false }) + '\n\n') if (stats.hasErrors()) { console.log(chalk.red(' Build failed with errors.\n')) process.exit(1) } console.log(chalk.cyan(' Build complete.\n')) console.log(chalk.yellow( ' Tip: built files are meant to be served over an HTTP server.\n' + ' Opening index.html over file:// won\'t work.\n' )) }) })
serverCompiler.watch({ // watchOptions 示例 aggregateTimeout: 300, poll: undefined }, (err, stats) => { // 在这里打印 watch/build 结果... console.log(chalk.bgGreen('\n √ Server compile done ') + '\n'); if (err) { console.error(err); return; } if(stats.hasErrors()){ console.log(chalk.red('\n ✖️ Server compile Error ') + '\n'); console.log(stats.toString({ chunks: false, // 使构建过程更静默无输出 colors: true // 在控制台展示颜色 })); } })