-
-
Save maxgfr/1df86e21ae01a7fb9acbb429839c66fb to your computer and use it in GitHub Desktop.
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: | |
- '**/*' |
{ | |
"scripts": { | |
"start": "node server.js" | |
} | |
} |
const cli = require('next/dist/cli/next-start'); | |
cli.nextStart([ | |
'-p', process.env.PORT || 3000, | |
'-H', process.env.HOSTNAME || '0.0.0.0', | |
]); |
Hello there, It works well.
Buy I couldn't connect my domain to the EBS.
I added alias from route 53.
And then, I added new listener to the load balancer, for HTTPS. And added my certificate (that works for another projects).
But It can not connect. What could be wrong with that?
I guess you need to configure port to 80 for http requests.
works like a charm
Using
- '**/*'
you copy over every file, including the node_modules folder. is there a way to only copy the .next folder with the builded code?
for those wondering about @manuelsechi comment
yes, you can with the following:
artifacts:
base-directory: 'out'
files:
- "**/*"
@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!
This solved my issue - thank you!