deployment-platforms
Vercel
Intro
- Install vercel with this command:
npm install -g vercel
- login to your vercel account using
vercel login
vercel login
Anytime you want to deploy your app, use the vercel --prod command.
{
"scripts": {
"deploy": "vercel --prod"
}
}
Simply run npm run deploy to deploy your app.
Essential commands
vercel switch: switch vercel team accountsvercel list: list all vercel projects
Linking existing projects
Link existing vercel projects to your local codebase with vercel link
Ignoring typescript errors
Your files must be all error-free for typescript linting, otherwise vercel will not deploy your app. To do this, put a //@ts-nocheck comment at the top of all typescript files with errors in them.
Now you can deploy with npm run deploy
Deploying different frameworks
Deploying React apps to vercel
When doing client side routing, you MUST have a vercel.json in the root of your project that specifies to redirect all requests to the index HTML:
vercel.json
{
"rewrites": [
{
"source": "/:path*",
"destination": "/index.html"
}
]
}