Reputation: 1
I have a .next build folder from a Next.js project and want to deploy it on Vercel without the source code. I pushed only the .next folder to GitHub.
My Vercel settings:
Build Command: echo "Build skipped" Install Command: echo "Dependencies not installed" Output Directory: .next
Getting "404: NOT_FOUND". How can I deploy just the build output?
Upvotes: -1
Views: 41
Reputation: 34
I'm guessing its because the routing is not set up.
Try this instead:
Your deployment folder should contain
1. .next/ folder (your next build folder)
2. package.json
3. vercel.json (optional)
4. next.config.json (if you have one)
Make a vercel.json file
{
"version": 2,
"routes": [
{ "src": "/_next/(.*)", "dest": "/.next/$1" },
{ "src": "/(.*)", "dest": "/.next/server/pages/$1" }
]
}
The first rule is for static assets, and the second one is for routing all requests to the pre-built next.js pages in your build file.
Deploy using Vercel CLI (if you have one installed)
vercel --prod ./deployment-folder
Test if it works.
Upvotes: 0