SolidStart
import { Render, PackageManagers } from "~/components";
Solid is an open-source web application framework focused on generating performant applications with a modern developer experience based on JSX.
In this guide, you will create a new Solid application implemented via SolidStart (Solid's meta-framework) and deploy it using Cloudflare Pages.
Create a new project
Use the create-cloudflare CLI (C3) to set up a new project. C3 will create a new project directory, initiate Solid's official setup tool, and provide the option to deploy instantly.
To use create-cloudflare to create a new Solid project, run the following command:
You will be prompted to select a starter. Choose any of the available options. You will then be asked if you want to enable Server Side Rendering. Reply yes. Finally, you will be asked if you want to use TypeScript, choose either yes or no.
create-cloudflare will then install dependencies, including the Wrangler CLI and the SolidStart Cloudflare Pages adapter, and ask you setup questions.
After you have installed your project dependencies, start your application:
npm run dev
SolidStart Cloudflare configuration
In order to configure SolidStart so that it can be deployed to Cloudflare pages, update its config file like so:
import { defineConfig } from "@solidjs/start/config";
export default defineConfig({
+ server: {
+ preset: "cloudflare-pages",
+ rollupConfig: {
+ external: ["node:async_hooks"]
+ }
+ }
});
Deploy with Cloudflare Pages
<Render file="deploy-via-c3" product="pages" params={{ name: "Solid" }} />
Deploy via the Cloudflare dashboard
| Configuration option | Value |
|---|---|
| Production branch | main |
| Build command | npm run build |
| Build directory | dist |
After configuring your site, you can begin your first deploy. You should see Cloudflare Pages installing npm, your project dependencies, and building your site before deploying it.
:::note
For the complete guide to deploying your first site to Cloudflare Pages, refer to the Get started guide.
:::
After deploying your site, you will receive a unique subdomain for your project on *.pages.dev.
Every time you commit new code to your Solid repository, Cloudflare Pages will automatically rebuild your project and deploy it. You will also get access to preview deployments on new pull requests, to preview how changes look to your site before deploying them to production.
<Render file="framework-guides/learn-more" product="pages" params={{ one: "Solid" }} />
谢谢你的反馈!