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 in public folder.
  • Create file netlify.toml in root project.
/*    /index.html   200
_redirects

[build]
  command = "yarn build"
  publish = "build"
netlify.toml

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/",
  },
package.json

[build]
  command = "npm run build-netlify"
  publish = ".next"
 
[[plugins]]
  package = "@netlify/plugin-nextjs"
netlify.toml

Azure

Firebase

Heroku

App Platform

Vite

https://vitejs.dev/guide/static-deploy.html