Deployment
Each server has different functionality and deployment configuration.
Make sure you have configured it correctly according to your service provider's instructions.
Vercel
Vercel ready to deploy has strong support for Next.js so we encourage you to use it to deploy your project.
Netlify
CRA
- Create file
_redirects
inpublic
folder. - Create file
netlify.toml
in root project.
/* /index.html 200
[build]
command = "yarn build"
publish = "build"
Next.js
- Update in
package.json
. - Create file
netlify.toml
in root project. - Connect with git and deploy.
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"build-netlify": "next build && cp -r .next _next && mv _next .next/",
},
[build]
command = "npm run build-netlify"
publish = ".next"
[[plugins]]
package = "@netlify/plugin-nextjs"
Azure
Firebase
Heroku
App Platform
Vite
https://vitejs.dev/guide/static-deploy.html
Note:
Please add environment variables on the deployment server if required.
Example on vercel server: