Exclude Files from Deployments with .vercelignore
The file can be used to specify files and directories that should be excluded from the deployment process when using Vercel. This file works similarly to a file, but it is specific to Vercel.
The file should be placed in the root directory of your project and should contain a list of files and directories, one per line, that should be excluded from deployment. For example, to prevent an directory and file within a project from being uploaded to Vercel, you would add them to the file like this:
A typical file assumes all files are allowed and each entry is a pattern to ignore. Alternatively, you can ignore all files and each entry is a pattern to allow.
Add a wildcard as the first line in to ensure all directories and files in the project root are ignored. The following lines must then start with a to invert the ignore action and ensure the directory or file is allowed.
Aside from the default exclusions, all files within your project are uploaded to Vercel if no source path is specified to be excluded in a configuration file
The complete list of files and directories excluded by default can be found in the ignored files and folders documentation.
The use of a configuration file allows you to keep private files safe and also makes your deployment faster by uploading only the essential files. Non-targeted files are prevented from being deployed and served on Vercel.
If you have a monorepo, a in the project root directory always takes precedence over one that is defined at the root level. If there is no to be found at the project level, Vercel will use the at the root level.
Was this helpful?