1 |
|
2 |
|
3 | const chalk = require('chalk');
|
4 | const printBuildError = require('react-dev-utils/printBuildError');
|
5 | const build = require('./build-wrapper');
|
6 |
|
7 | const config = require('../../configs/webpack.server.prod');
|
8 |
|
9 | console.log(chalk.magenta('Building server...'));
|
10 |
|
11 | build(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 | });
|