Create and Deploy a Preact App with Vercel

Create your Preact app and deploy it with Vercel.

Preact is a fast 3kB alternative to React with the same modern API.

In this guide, we will cover how to set up a Preact app with Preact CLI and how to deploy it with Vercel.

Step 1: Set Up Your Preact Project

If you do not have the Preact CLI installed currently, use the following command to install it globally:

npm i -g preact-cli

Installing Preact CLI globally with npm.

Get started by setting up a Preact app with Preact CLI and the following command:

preact create default my-preact-app && cd my-preact-app

Bootstrapping a Preact app with Preact CLI.

Step 2: Deploying Your Preact Project with Vercel

To deploy your Preact app with a Vercel for Git, make sure it has been pushed to a Git repository.

Import the project into Vercel using your Git of choice:

After your project has been imported, all subsequent pushes to branches will generate Preview Deployments, and all changes made to the Production Branch (commonly "main") will result in a Production Deployment.

Once deployed, you will get a URL to see your app live, such as the following: https://preact.now-examples.now.sh

Set up a Preact app with a few clicks using the Deploy button, and create a Git repository for it in the process for automatic deployments for your updates.



Written By
Written by mcsdevmcsdev
Last Edited on December 14th 2020