I recently created a personal website using SolidJS, with server side rendering and typescript enabled. I attempted to deploy this site to Vercel, with the only change from the base Vercel settings being that I changed the Output Directory to 'dist'. However, after deploying the site I am getting a 404 error. You can find the uploaded site (and the error) here, and the github repo for my solidjs project here. I have also attached a screenshot of my Vercel Build & Development Settings. Does anyone have any advice on how to fix this issue? Thank you!

3 Answers
The answer was to change my vite config to plugins to ''' plugins: [solid({adapter: vercel()})], '''
1 Comment
server: {preset: "vercel"}Adding on to @Harry Alberts answer:
You'll need to npm i solid-start-vercel to install SolidJS Adapter for Vercel
Then add:
import vercel from "solid-start-vercel";
to the vite.config.ts file along with this:
export default defineConfig({
plugins: [
solid({ adapter: vercel({ edge: true }) })
],
});
I tried this solid({ adapter: vercel() }) but got an error since the vercel() function expects an argument of type SolidStartVercelOptions which has these as keys:
{
edge: boolean,
includes: string | string[],
excludes: string | string[],
prerender: PrerenderFunctionConfig
}
And if you have the vercel cli installed, run this:
vercel env add ENABLE_VC_BUILD
and set the the value of ENABLE_VC_BUILD to 1
Hope this is enough information for those needing it.
Reference:
1 Comment
As of 2024 June 27, SolidStart 1.0.2 + SolidJs 1.8.17 comes with app.config.ts. So delete vercel.json, and vite.config.js.
In your app.config.ts, add this line: server: {preset: "vercel"}
import { defineConfig } from "@solidjs/start/config";
export default defineConfig({
server: {preset: "vercel"}
//plugins: [solid({ adapter: vercel() })]
});
In Vercal project settings:
- Under
Build & Development Settings: leave all settings blank. - Usually your Solid project should be in your repo root. So leave
Root Directorysetting empty. - Under
Node.js Version: setting here should match the NodeJs version you use during development, and the setting in your package.json:
"engines": {
"node": ">=20.12.2"
}