Experiment: Next.js via custom server.
ryan-roemer opened this issue · 2 comments
ryan-roemer commented
- Follow the custom server Next.js guide with
serverless-http - Review packaging with Jetpack to make sure we don't bring in all the dev stuff we don't need.
- Verify it actually works.
ryan-roemer commented
So far in branch https://github.com/FormidableLabs/nextjs-serverless-demo/tree/experiment/nextjs-custom-server there is a lot of cold start latency in the Next.js app. It needs prepare() which adds 3s on my machine and lazy compiles each page at varying latencies:
$ yarn start
yarn run v1.22.5
$ eval $(yarn -s env) && node server/index.js
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
event - compiled successfully
{ message: 'Next.js prepare() time', elapsedMs: 3398 }
Server started at http://0.0.0.0:3000
event - build page: /
wait - compiling...
event - compiled successfully
event - build page: /posts/[id]
wait - compiling...
event - compiled successfully
ryan-roemer commented
Implemented in #9