项目根目录放置 vercel.json 并跟随git一起提交,内容示例如下
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"rewrites": [{ "source": "/(.*)", "destination": "/index.html" }],
"framework": "vue",
"buildCommand": "npm run copy:libarchive && run-p type-check \"build-only {@}\" --"
}
其中
-
$schema指的是用哪个协议, -
rewrites用于配置为SPA(单页面应用,如果不需要可以删除该行) -
framework所用的框架,默认是 nextjs(即vercel自家的产品), 对于vue项目直接填写vue,其它项目可以访问 https://openapi.vercel.sh/vercel.json 找到framework节点查看所有支持的配置 -
buildCommand默认是npm run build,但如果构建方式比较特殊,可以在这里指定