You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/adapter-cloudflare-workers/README.md
+27-10Lines changed: 27 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,19 @@ export default {
33
33
34
34
**You will need [Wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update) installed on your system**
35
35
36
-
This adapter expects to find a [wrangler.toml](https://developers.cloudflare.com/workers/platform/sites/configuration) file in the project root. It will determine where to write static assets and the worker based on the `site.bucket` and `site.entry-point` settings.
36
+
This adapter expects to find a [wrangler.toml](https://developers.cloudflare.com/workers/platform/sites/configuration) file in the project root. It will determine where to write static assets and the worker based on the `site.bucket` and `build.upload` settings. These values must be set to the following:
37
37
38
-
Generate this file using `wrangler` from your project directory
38
+
```toml
39
+
[build.upload]
40
+
format = "modules"
41
+
dir = "./.svelte-kit/cloudflare"
42
+
main = "./_worker.mjs"
43
+
44
+
[site]
45
+
bucket = "./.svelte-kit/cloudflare-bucket"
46
+
```
47
+
48
+
To get started, generate this file using `wrangler` from your project directory
39
49
40
50
```sh
41
51
wrangler init --site my-site-name
@@ -48,24 +58,31 @@ Now you should get some details from Cloudflare. You should get your:
48
58
49
59
Get them by visiting your [Cloudflare dashboard](https://dash.cloudflare.com) and click on any domain. There, you can scroll down and on the left, you can see your details under **API**.
50
60
51
-
Then configure your sites build directory and your account-details in the config file:
61
+
Then configure your account-details in the config file:
52
62
53
63
```toml
54
-
account_id = 'YOUR ACCOUNT_ID'
55
-
zone_id = 'YOUR ZONE_ID'# optional, if you don't specify this a workers.dev subdomain will be used.
56
-
site = {bucket = "./build", entry-point = "./workers-site"}
57
-
64
+
name = "<your-site-name>"
58
65
type = "javascript"
66
+
account_id = "<your-account-id>"
67
+
workers_dev = true
68
+
route = ""
69
+
zone_id = ""
70
+
71
+
compatibility_date = "2022-02-09"
59
72
60
73
[build]
61
74
# Assume it's already been built. You can make this "npm run build" to ensure a build before publishing
62
75
command = ""
63
76
77
+
# All values below here are required by adapter-cloudflare-workers and should not change
64
78
[build.upload]
65
-
format = "service-worker"
66
-
```
79
+
format = "modules"
80
+
dir = "./.svelte-kit/cloudflare"
81
+
main = "./_worker.mjs"
67
82
68
-
It's recommended that you add the `build` and `workers-site` folders (or whichever other folders you specify) to your `.gitignore`.
0 commit comments