As I am writing this blog post Cloudflare Pages is still in open beta.
So here is a quick tour on how you can set up your svelte project on cloudflare pages.
First things first.
Login to your cloudflare account (if you don't have one yet, it is really easy to set one up).
Select the icon on the right for cloudflare pages.
After that you can create a new project.
On the next page you can set you project name and build settings. There is already a configuration for svelte that you can select from the dropdown. If needed you can adapt the values to your specific setup.
The first build took a little longer, so no need to worry if it is not immediately done (I guess this is due to the fact that the first setup of your instance takes some time).
So after your first build you can access your site on your-project.pages.dev. If you have your domain set up with cloudflare you can easily set up a custom domain for your project.
After that your svelte site is ready to shine on cloudflare pages.
Looking for a shareable component template? Go here --> sveltejs/component-template
To create a new project based on this template using degit:
npx degit sveltejs/template svelte-app cd svelte-app
Note that you will need to have Node.js installed.
Install the dependencies...
cd svelte-app npm install
...then start Rollup:
npm run dev
Navigate to localhost:5000. You should see your app running. Edit a component file in
src, save it, and reload the page to see your changes.
By default, the server will only respond to requests from localhost. To allow connections from other computers, edit the
sirv commands in package.json to include the option