E.g. I’d like to have my Prod domain linked to my gh-repo/coming-soon/
folder and my Dev domain (preview) linked to gh-repo/preview/
. Is this possible?
Hello, and welcome, @42piratas!
Yes, you can point your production and development deployments to different folders in the same GitHub repository on Vercel with a vercel.json
file in the root of your repository.
Something like this setup will allow Vercel to recognize that it should use different build configurations based on the specified folders.
{
"builds": [
{
"src": "coming-soon/package.json",
"use": "@vercel/node"
},
{
"src": "preview/package.json",
"use": "@vercel/node"
}
]
}
To deploy different folders for production and development environments, you also need to configure your project settings on Vercel to use different branches or set up custom build commands.
You’ll need to configure your Vercel Project settings. from your Vercel project dashboard, go to Settings > Git and set the Production Branch to main
.
Make sure that your development branch (e.g., dev
) is used for preview deployments.
In Settings > Build & Development Settings, specify custom build commands for each environment.
For example:
Production Build Command:
cd coming-soon && npm install && npm run build
Preview Build Command:
cd preview && npm install && npm run build
For detailed steps and examples, refer to relevant documentation.
Thank you very much for you help! I really appreciate it!
You’re welcome, @42piratas!
Feel free to drop by Introductions by the way. Would love to hear more about what you’re building!
Thanks for being part of the community.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.