Last active
June 13, 2023 21:15
-
-
Save maxgfr/1df86e21ae01a7fb9acbb429839c66fb to your computer and use it in GitHub Desktop.
Configuration for NextJS for AWS pipeline (Github webhook - Codebuild - Elastic Beanstalk)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 0.2 | |
phases: | |
install: | |
commands: | |
- echo Installing dependency... | |
- npm install -g next | |
- yarn | |
pre_build: | |
commands: | |
- printenv > .env | |
build: | |
commands: | |
- echo Compiling the Node.js code | |
- yarn build | |
post_build: | |
commands: | |
- echo Build completed on `date` | |
artifacts: | |
files: | |
- '**/*' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"start": "node server.js" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cli = require('next/dist/cli/next-start'); | |
cli.nextStart([ | |
'-p', process.env.PORT || 3000, | |
'-H', process.env.HOSTNAME || '0.0.0.0', | |
]); |
@crjrdemant not sure what "out" is
next.js usually puts builded files into the .next dir.
can you better explain please?
@manuelsechi I am brand new to Next.js, just started my first project. Using the latest version of Next.js the documentation to generate output files for a static website (no Node backend) instructs you to configure next.config.js
to have this:
const nextConfig = { output: 'export' }
This will build out the static-website ready files in the /out
directory. Might be something with newer versions of Next.js? Or perhaps this is exclusively the output directory for no-backend static files. Hope that helps!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
for those wondering about @manuelsechi comment
yes, you can with the following: