Add production standalone build instructions in readme #1491
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Add instructions to README for how to use the production standalone build.
Why
The readme's production instructions don't align with how next.js standalone builds are intended to be deployed. The instructions say to use
yarn start
which is convenient, but isn't actually running the standalone production build thatyarn build
produced. Usingyarn start
outputs a warning indicating this.The
next.config.js
file configures the build to be a standalone build here:laboratory/next.config.js
Line 3 in 2fe31e3
A standalone build doesn't need yarn, or the repo. It only needs the
static
andstandalone
directories from thebuild
directory.For more details see https://nextjs.org/docs/pages/api-reference/config/next-config-js/output#automatically-copying-traced-files.
I took a look at this as part of looking into how quickstart was deploying lab (stellar/quickstart#706). It was including the entire repo because it was using
yarn start
. Next.js' standalone build isn't as well documented as it could be and based on the number of discussion threads online it's not obvious to anyone, including myself as it took me several threads to understand what was going on with it. Including the instructions here in the readme can serve to knowledge share this.