Vite 3
Vite ↗ is a next-generation build tool for front-end developers. With the release of Vite 3 ↗, developers can make use of new command line (CLI) improvements, starter templates, and more ↗ to help build their front-end applications.
Cloudflare Pages has native support for Vite 3 projects. Refer to the blog post on improvements to the Pages build process ↗, including sub-second build initialization, for more information on using Vite 3 and Cloudflare Pages to optimize your application’s build tooling.
In this guide, you will learn how to start a new project using Vite 3, and deploy it to Cloudflare Pages.
You will now create a new GitHub repository, and push your code using GitHub’s gh
command line (CLI) ↗:
To deploy your site to Pages:
- Log in to the Cloudflare dashboard ↗ and select your account.
- In Account Home, select Workers & Pages > Create application > Pages > Connect to Git.
- Select your new GitHub repository.
- In the Set up builds and deployments, set
npm run build
as the Build command, anddist
as the Build output directory.
After completing configuration, select Save and Deploy.
You will see your first deploy pipeline in progress. Pages installs all dependencies and builds the project as specified. After you have deployed your project, it will be available at the <YOUR_PROJECT_NAME>.pages.dev
subdomain. Find your project’s subdomain in Workers & Pages > select your Pages project > Deployments.
Cloudflare Pages will automatically rebuild your project and deploy it on every new pushed commit.
Additionally, you will have access to preview deployments, which repeat the build-and-deploy process for pull requests. With these, you can preview changes to your project with a real URL before deploying them to production.
By completing this guide, you have successfully deployed your Vite 3 site to Cloudflare Pages. To get started with other frameworks, refer to the list of Framework guides.