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
If your Next.js app currently uses `@cloudflare/next-on-pages`, you'll want to remove it, and make a few changes.
96
+
93
97
#### Remove `export const runtime = "edge";`
94
98
95
99
Before deploying your app, remove the `export const runtime = "edge";` line from your `next.config.js` file. This line is not needed when using `@opennextjs/cloudflare`.
@@ -98,7 +102,28 @@ Before deploying your app, remove the `export const runtime = "edge";` line from
98
102
99
103
You should add `.worker-next` to your `.gitignore` file to prevent the build output from being committed to your repository.
100
104
101
-
#### Uninstall next-on-pages
105
+
#### Remove references to `@cloudflare/next-on-pages`:
106
+
107
+
You no longer need to call `setupDevPlatform()` in your `next.config.mjs` file:
108
+
109
+
```diff title="next.config.mjs"
110
+
- import { setupDevPlatform } from '@cloudflare/next-on-pages/next-dev';
111
+
112
+
/** @type {import('next').NextConfig} */
113
+
const nextConfig = {};
114
+
115
+
- if (process.env.NODE_ENV === 'development') {
116
+
- await setupDevPlatform();
117
+
- }
118
+
119
+
And you'll want to replace any uses of `getRequestContext` from `@cloudflare/next-on-pages` with `getCloudflareContext` from `@opennextjs/cloudflare`:
120
+
121
+
```diff
122
+
- import { getRequestContext } from "@cloudflare/next-on-pages";
123
+
+ import { getCloudflareContext } from "@opennextjs/cloudflare";
124
+
```
125
+
126
+
#### Uninstall `@cloudflare/next-on-pages`
102
127
103
128
You should uninstall `@cloudflare/next-on-pages` and remove any references to it.
104
129
@@ -111,9 +136,7 @@ You should uninstall `@cloudflare/next-on-pages` and remove any references to it
111
136
"devDependencies": {
112
137
- "@cloudflare/next-on-pages": "*",
113
138
```
114
-
(remember to also remove the eslint-plugin-next-on-pages from your `.eslintrc.js` file)
115
-
116
-
Be sure to search through any other files in your project for references to `@cloudflare/next-on-pages` and remove them.
139
+
(remember to also remove [eslint-plugin-next-on-pages](https://www.npmjs.com/package/eslint-plugin-next-on-pages) from your `.eslintrc.js` file)
117
140
118
141
##### 5. Develop locally
119
142
@@ -129,4 +152,4 @@ Either deploy via the command line:
129
152
npm run deploy:worker
130
153
```
131
154
132
-
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.
155
+
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.
0 commit comments