I am trying to deploy an express app made with typescript to vercel. But no matter how hard I try I am getting 404.
I have configured my tsconfig.json file in a way, so that When I run npm run build
locally, it creates a dist folder in the root. In package.json
file I have set the start command to node dist/index.js. After building the file locally, when I try npm start
, it works fine. But the problem is when I deploy it to vercel it doesn’t work. This is my vercel.json
file:
{
"version": 2,
"builds": [
{
"src": "dist/index.js",
"use": "@vercel/node"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/dist/index.js"
}
]
}
In the vercel dashboard I have set the output directory to dist. Here is the screenshot.
I have tried several changes in the vercel.json
file, like changing the src
and dest
properties. But none worked.