Skip to content

Commit 7a83bf1

Browse files
authored
Add wrangler installation step in Next.js workers guide (#21568)
1 parent 4995a47 commit 7a83bf1

File tree

1 file changed

+10
-6
lines changed
  • src/content/docs/workers/frameworks/framework-guides

1 file changed

+10
-6
lines changed

src/content/docs/workers/frameworks/framework-guides/nextjs.mdx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ You can convert an existing Next.js application to run on Cloudflare
9696

9797
<PackageManagers type="install" pkg="@opennextjs/cloudflare@latest" />
9898

99-
2. **Add a Wrangler configuration file**
99+
2. **Install [`wrangler CLI`](https://developers.cloudflare.com/workers/wrangler) as a devDependency**
100+
101+
<PackageManagers type="install" pkg="wrangler@latest" dev />
102+
103+
3. **Add a Wrangler configuration file**
100104

101105
In your project root, create a [Wrangler configuration file](/workers/wrangler/configuration/) with the following content:
102106

@@ -116,7 +120,7 @@ You can convert an existing Next.js application to run on Cloudflare
116120
As shown above, you must enable the [`nodejs_compat` compatibility flag](/workers/runtime-apis/nodejs/) _and_ set your [compatibility date](/workers/configuration/compatibility-dates/) to `2024-09-23` or later for your Next.js app to work with @opennextjs/cloudflare.
117121
:::
118122

119-
3. **Add a configuration file for OpenNext**
123+
4. **Add a configuration file for OpenNext**
120124

121125
In your project root, create an OpenNext configuration file named `open-next.config.ts` with the following content:
122126

@@ -130,7 +134,7 @@ You can convert an existing Next.js application to run on Cloudflare
130134
`open-next.config.ts` is where you can configure the caching, see the [adapter documentation](https://opennext.js.org/cloudflare/caching) for more information
131135
:::
132136

133-
4. **Update `package.json`**
137+
5. **Update `package.json`**
134138

135139
You can add the following scripts to your `package.json`:
136140

@@ -148,21 +152,21 @@ You can convert an existing Next.js application to run on Cloudflare
148152
root of your project containing the types for the env.
149153
</Details>
150154

151-
5. **Develop locally.**
155+
6. **Develop locally.**
152156

153157
After creating your project, run the following command in your project directory to start a local development server.
154158
The command uses the Next.js development server. It offers the best developer experience by quickly reloading your app after your source code is updated.
155159

156160
<PackageManagers type="run" args="dev" />
157161

158-
6. **Test your site with the Cloudflare adapter.**
162+
7. **Test your site with the Cloudflare adapter.**
159163

160164
The command used in the previous step uses the Next.js development server to offer a great developer experience.
161165
However your application will run on Cloudflare Workers so you want to run your integration tests and verify that your application workers correctly in this environment.
162166

163167
<PackageManagers type="run" args="preview" />
164168

165-
7. **Deploy your project.**
169+
8. **Deploy your project.**
166170

167171
You can deploy your project to a [`*.workers.dev` subdomain](/workers/configuration/routing/workers-dev/) or a [custom domain](/workers/configuration/routing/custom-domains/) from your local machine or any CI/CD system (including [Workers Builds](/workers/ci-cd/#workers-builds)). Use the following command to build and deploy. If you're using a CI service, be sure to update your "deploy command" accordingly.
168172

0 commit comments

Comments
 (0)