Deploy your Thulite Site to Cloudflare Pages
You can deploy your Thulite project on Cloudflare Pages, a JAMstack platform for frontend developers to collaborate and deploy websites.
This guide includes:
- How to deploy through the Cloudflare Pages Dashboard
- How to deploy using Wrangler, the Cloudflare CLI
Prerequisites
To get started, you will need:
- A Cloudflare account. If you don’t already have one, you can create a free Cloudflare account during the process.
- Your app code pushed to a GitHub or a GitLab repository.
How to deploy a site with Git
-
Set up a new project on Cloudflare Pages.
-
Push your code to your git repository (GitHub, GitLab).
-
Log in to the Cloudflare dashboard and select your account in Account Home > Pages.
-
Select Create a new Project and the Connect Git option.
-
Select the git project you want to deploy and click Begin setup
-
Use the following build settings:
- Framework preset:
exit 0
- Build command:
npm run build
- Build output directory:
public
- Framework preset:
-
Click the Save and Deploy button.
How to deploy a site using Wrangler
-
Install the Wrangler CLI in your project:
-
Authorize Wrangler with your Cloudflare account using OAuth:
-
Run your build command:
-
Deploy the build output directory as a Pages deployment:
After your assets are uploaded, Wrangler will give you a preview URL to inspect your site. When you log into the Cloudflare Pages dashboard, you will see your new project.
Enabling Preview locally with Wrangler
Update the preview script to run wrangler
instead of Thulite’ built-in preview command:
Troubleshooting
If you’re encountering errors, check whether the node
version you’re using locally (node -v
) matches the NODE_VERSION
environment variable under Settings.