Skip to content

Commit c7be49c

Browse files
vicbcodercatdev
andauthored
update cloudflare docs (#68)
Co-authored-by: Alex Patterson <[email protected]>
1 parent a68951f commit c7be49c

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

pages/cloudflare/get-started.mdx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,12 @@ The `NEXTJS_ENV` variable defines the environment to use when loading Next.js `.
128128
Add the following to the scripts field of your `package.json` file:
129129

130130
```json
131-
"build:worker": "opennextjs-cloudflare",
132-
"dev:worker": "wrangler dev --port 8771",
133-
"preview": "npm run build:worker && npm run dev:worker",
134-
"deploy": "npm run build:worker && wrangler deploy",
131+
"preview": "opennextjs-cloudflare && wrangler dev",
132+
"deploy": "opennextjs-cloudflare && wrangler deploy",
135133
"cf-typegen": "wrangler types --env-interface CloudflareEnv cloudflare-env.d.ts",
136134
```
137135

138-
- `npm run build:worker`: Runs the [@opennextjs/cloudflare](https://www.npmjs.com/package/@opennextjs/cloudflare) adapter. This first builds your app by running the `build` script in your `package.json` (Next.js apps use `next build` by default), and then transforms the build output to a format that you can run locally using [Wrangler](https://developers.cloudflare.com/workers/wrangler/), and deploy to Cloudflare. The build command used by OpenNext can be overridden with the `buildCommand` option in your OpenNext config.
139-
- `npm run dev:worker`: Takes the output generated by `build:worker` and runs it locally in [workerd](https://github.com/cloudflare/workerd), the open-source Workers Runtime, allowing you to run the app locally in the same environment that it will run in production. If you instead run `next dev`, your app will run in Node.js, which is a different JavaScript runtime from the Workers runtime, with differences in behavior and APIs.
140-
- `npm run preview`: Runs `build:worker` and then `dev:worker`, allowing you to quickly preview your app running locally in the Workers runtime, via a single command.
136+
- `npm run preview`: Builds your app and serves it locally, allowing you to quickly preview your app running locally in the Workers runtime, via a single command.
141137
- `npm run deploy`: Builds your app, and then deploys it to Cloudflare
142138
- `cf-typegen`: Generates a `cloudflare-env.d.ts` file at the root of your project containing [the types for the `env`](https://developers.cloudflare.com/workers/wrangler/commands/#types).
143139

@@ -193,15 +189,15 @@ export default nextConfig;
193189
After having added the `initOpenNextCloudflareForDev()` call in your Next.js configuration file, you will be able, during local
194190
development, to access in any of your server code, local versions of Cloudflare bindings as indicated in the [bindings documentation](./bindings).
195191

196-
In step 3, we also added the `npm run preview:worker`, which allows you to quickly preview your app running locally in the Workers runtime,
192+
In step 3, we also added the `npm run preview`, which allows you to quickly preview your app running locally in the Workers runtime,
197193
rather than in Node.js. This allows you to test changes in the same runtime as your app will run in when deployed to Cloudflare.
198194

199195
##### 12. Deploy to Cloudflare Workers
200196

201197
Either deploy via the command line:
202198

203199
```sh
204-
npm run deploy:worker
200+
npm run deploy
205201
```
206202

207203
Or [connect a Github or Gitlab repository](https://developers.cloudflare.com/workers/ci-cd/), and Cloudflare will automatically build and deploy each pull request you merge to your production branch.

pages/cloudflare/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ We will update the list as we progress towards releasing 1.0.
5252
- [x] [Middleware](https://nextjs.org/docs/app/building-your-application/routing/middleware)
5353
- [x] [Image optimization](https://nextjs.org/docs/app/building-your-application/optimizing/images) (you can integrate Cloudflare Images with Next.js by following [this guide](https://developers.cloudflare.com/images/transform-images/integrate-with-frameworks/))
5454
- [x] [Partial Prerendering (PPR)](https://nextjs.org/docs/app/building-your-application/rendering/partial-prerendering)
55+
- [x] [Pages Router](https://nextjs.org/docs/pages)
5556
- [ ] [Support for after](https://nextjs.org/blog/next-15-rc#executing-code-after-a-response-with-nextafter-experimental)
56-
- [ ] [Pages Router](https://nextjs.org/docs/pages)
5757
- [ ] [Incremental Static Regeneration (ISR)](https://nextjs.org/docs/app/building-your-application/data-fetching/incremental-static-regeneration)
5858
- [ ] [Composable Caching](https://nextjs.org/blog/composable-caching) (`'use cache'`) is a Next.js 15 feature and not supported yet.
5959

0 commit comments

Comments
 (0)