You can set up Vercel to trigger deployments only when certain directories change by using the Ignored Build Step. This is a helpful way to avoid unnecessary deployments and save build minutes, especially if you have parts of your project that don’t need to rebuild every time.
Here are two approaches you can use:
Option 1: Configure it in the Dashboard
- Open your project in the Vercel Dashboard
- Go to the Git section in your project settings
- Under Ignored Build Step, add the following command:
1git diff HEAD^ HEAD --quiet ./web
This checks whether anything in the web directory has changed. If not, the command exits cleanly and Vercel skips the build. If there are changes, the deployment continues as usual.
Option 2: Add it to vercel.json
If you prefer keeping everything in version control, you can add this to your vercel.json file:
1{2 "git": {3 "deploymentEnabled": {4 "main": false5 }6 },7 "ignoreCommand": "git diff HEAD^ HEAD --quiet ./web"8}
This prevents the deployment from starting at all when there are no changes in the web folder, which means it won’t count against your deployment limits.