This repository comes from the official NextJS repository, and is used for the purpose of showing how you can do NextJS application deployment using the Serverless Lift plugin, along with construct static-webiste).
Before the deployment, the application we need to export the NextJS app to static HTML.
Fortunately, NextJS allows export to static html. All we had to do was change the configuration slightly in package.json
...
"build": "next build && next export",
...
npm install
npm run build
Above commands will install all packages, build the project, and export it into the statics html within the out
folder.
Please consider that not every NextJS project can be exported to static HTML. Not all functionalities are compatible with next export
.
So you could see errors like:
Error: Image Optimization using Next.js' default loader is not compatible with `next export`.
The process involved in deployment will be done through Serverless Framework
from the root of this project.