Example of deploying a Vite + vite-plugin-ssr
app to Vercel.
Docs
See vite-plugin-ssr.com/vercel.
Run
To run the example:
-
git clone [email protected]: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 [email protected]: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
dist/server/importBuild.js
Note how we load dist/server/importBuild.js
in api/render.js.