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
In order for `frames.js` to work properly in [Cloudflare Workers](https://workers.cloudflare.com) you must replace the `@vercel/og` dependency with `workers-og`. Follow following steps to override the dependency.
26
-
27
5
::::steps
28
6
29
-
### Override `@vercel/og` package with `workers-og`
30
-
31
-
Add following to your `package.json`.
32
-
33
-
:::code-group
34
-
35
-
```json [npm]
36
-
{
37
-
"overrides": {
38
-
"frames.js": {
39
-
"@vercel/og": "npm:workers-og@^0.0.23"
40
-
}
41
-
}
42
-
}
43
-
```
44
-
45
-
```json [yarn]
46
-
{
47
-
"resolutions": {
48
-
"@vercel/og": "npm:workers-og"
49
-
}
50
-
}
51
-
```
52
-
53
-
```json [pnpm]
54
-
{
55
-
"pnpm": {
56
-
"overrides": {
57
-
"@vercel/og": "npm:workers-og@^0.0.23"
58
-
}
59
-
}
60
-
}
61
-
```
62
-
63
-
:::
64
-
65
-
### Install the dependencies
66
-
67
-
After you have overridden the `@vercel/og` package with `workers-og`, you can install the dependencies.
Open `tsconfig.json` and change the value of `compilerOptions.tsx` to `react-jsx`.
130
-
131
-
```json [tsconfig.json]
132
-
{
133
-
"compilerOptions": {
134
-
"jsx": "react-jsx"
135
-
}
136
-
}
137
-
```
138
-
139
-
### Change the entrypoint for your Frames handler
140
-
141
-
Open `wrangler.toml` and change the value of `main` to `src/index.tsx`.
142
-
143
-
```toml [wrangler.toml]
144
-
main = "src/index.tsx"
145
-
```
146
-
147
-
::::
27
+
Open `src/index.tsx` and edit the handler to your needs.
148
28
149
29
## Develop and test locally
150
30
151
-
You can test your Cloudflare Worker locally using `wrangler dev` and our [debugger](/guides/debugger#local-debugger-cli). Follow these steps to start developing locally:
152
-
153
-
::::steps
154
-
155
-
#### Start the local server
31
+
Run following command to start the local server and debugger to test your Frames app locally.
156
32
157
33
:::code-group
158
34
@@ -170,35 +46,9 @@ pnpm dev
170
46
171
47
:::
172
48
173
-
#### Start the debugger
174
-
175
-
After you started the local server, you can start the debugger by running the following command where you replace `<local-url>` with a URL on which local server is running (see the output of above command, e.g. `http://localhost:8787`).
176
-
177
-
:::code-group
178
-
179
-
```bash [npm]
180
-
npx @frames.js/debugger --url <local-url>
181
-
```
182
-
183
-
```bash [yarn]
184
-
# yarn v1 doesn't have an alternative to npx, so you have to install the debugger globally (or use npx)
185
-
yarn global add @frames.js/debugger && frames --url <local-url>
186
-
187
-
# yarn v2
188
-
yarn dlx @frames.js/debugger --url <local-url>
189
-
```
190
-
191
-
```bash [pnpm]
192
-
pnpm dlx @frames.js/debugger --url <local-url>
193
-
```
194
-
195
-
:::
196
-
197
-
::::
198
-
199
49
## Deploy to Cloudflare Workers
200
50
201
-
When you tested your Frames app locally and you are ready to deploy it to Cloudflare Workers, run the following command.
51
+
When you are done with development and testing, run the following command to deploy your Frames app to Cloudflare Workers.
0 commit comments