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:
Leo Lamprecht
2017-03-08 23:34:31 +01:00
committed by Dan Abramov
parent 4bc9e79f2a
commit 8c00af1440
2 changed files with 29 additions and 13 deletions

View File

@@ -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();
}
});