Example of deploying a Vite + vite-plugin-ssr app to Vercel.


See vite-plugin-ssr.com/vercel.


To run the example:

  1.  git clone [email protected]:brillout/vite-plugin-ssr
     cd vite-plugin-ssr/examples/vercel/
  2. 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
  3. 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.


View Github