mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-04-28 17:35:42 +08:00
Suggest serve for running in production (#1760)
* Suggest `serve` for serving the `build` directory * How to handle it with Node in prod (or other platforms) * Pretty newline added * Adjusted default port of static server * Remove `open` command from output * Removed constant assignment * Better explanation for not using having to use a static server * Cute newline added * Style nits
This commit is contained in:
committed by
Dan Abramov
parent
4bc9e79f2a
commit
8c00af1440
12
packages/react-scripts/scripts/build.js
vendored
12
packages/react-scripts/scripts/build.js
vendored
@@ -101,7 +101,6 @@ function build(previousFileSizes) {
|
||||
printFileSizesAfterBuild(stats, previousFileSizes);
|
||||
console.log();
|
||||
|
||||
const openCommand = process.platform === 'win32' ? 'start' : 'open';
|
||||
const appPackage = require(paths.appPackageJson);
|
||||
const publicUrl = paths.publicUrl;
|
||||
const publicPath = config.output.publicPath;
|
||||
@@ -184,17 +183,14 @@ function build(previousFileSizes) {
|
||||
}
|
||||
const build = path.relative(process.cwd(), paths.appBuild);
|
||||
console.log(`The ${chalk.cyan(build)} folder is ready to be deployed.`);
|
||||
console.log('You may also serve it locally with a static server:');
|
||||
console.log('You may serve it with a static server:');
|
||||
console.log();
|
||||
if (useYarn) {
|
||||
console.log(` ${chalk.cyan('yarn')} global add pushstate-server`);
|
||||
console.log(` ${chalk.cyan('yarn')} global add serve`);
|
||||
} else {
|
||||
console.log(` ${chalk.cyan('npm')} install -g pushstate-server`);
|
||||
console.log(` ${chalk.cyan('npm')} install -g serve`);
|
||||
}
|
||||
console.log(` ${chalk.cyan('pushstate-server')} build`);
|
||||
console.log(
|
||||
` ${chalk.cyan(openCommand)} http://localhost:${process.env.PORT || 9000}`
|
||||
);
|
||||
console.log(` ${chalk.cyan('serve')} -s build`);
|
||||
console.log();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user