Example of deploying a Vite + vite-plugin-ssr
app to Vercel.
See vite-plugin-ssr.com/vercel.
To run the example:
-
git clone git@github.com:brillout/vite-plugin-ssr cd vite-plugin-ssr/examples/vercel/
- Create a new Git repository and push it to GitHub/GitLab/...
git init git remote add origin git@github.com:your-username/vercel-vite-plugin-ssr git push origin master -u
- Create a Vercel account and authorize Vercel to access your newly created Git repository.
To develop (for increased dev speed we use an Express.js dev server instead of vercel dev
):
-
npm install # (do not use yarn, as yarn installs the entire monorepo) npm run dev
To deploy (Vercel's Git integration allows us to simply push to deploy):
-
git push
Note how we load dist/server/importBuild.js
in api/render.js.