UNPKG

1.08 kBJavaScriptView Raw
1/* eslint import/no-extraneous-dependencies: 0 */
2/* eslint no-console: 0 */
3const chalk = require('chalk');
4const printBuildError = require('react-dev-utils/printBuildError');
5const build = require('./build-wrapper');
6
7const config = require('../../configs/webpack.server.prod');
8
9console.log(chalk.magenta('Building server...'));
10
11build(config)
12 .then(({ warnings }) => {
13 if (warnings.length) {
14 console.log(chalk.yellow('Server compiled with warnings.\n'));
15 console.log(warnings.join('\n\n'));
16 console.log(
17 `Search for the ${chalk.underline(chalk.yellow('keywords'))} to learn more about each warning.`
18 );
19 console.log(
20 `To ignore, add ${chalk.cyan('// eslint-disable-next-line')} to the line before.`
21 );
22 } else {
23 console.log(chalk.green('Server compiled successfully.\n'));
24 }
25 })
26 .catch((err) => {
27 console.log(chalk.red('Failed to compile server.\n'));
28 printBuildError(err);
29 process.exit(1);
30 });