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
When running `nuxt build`, Nuxt will pre-render the `/` route and save the `index.html` file in the output directory.
28
+
When running `nuxt build`, Nuxt will pre-render the `/` route and save the `index.html` file in the output directory.
29
29
30
30
::callout{icon="i-ph-rocket-launch-duotone"}
31
31
When deploying with NuxtHub on Cloudflare Pages, it will serve the pre-rendered HTML file directly from the edge for maximum performance and avoid CPU usage on the server.
@@ -50,10 +50,14 @@ defineRouteRules({
50
50
This is equivalent of our example above in the `nuxt.config.ts` file.
51
51
52
52
**Notes:**
53
+
53
54
- A rule defined in `~/pages/foo/bar.vue` will be applied to `/foo/bar` requests.
54
55
- A rule in `~/pages/foo/[id].vue` will be applied to `/foo/**` requests.
NuxtHub will generate a [`dist/_routes.json`](https://developers.cloudflare.com/pages/functions/routing/#create-a-_routesjson-file) for Cloudflare Pages, but it has a limit of 100 excluded routes (used for static assets).
142
+
143
+
As each pre-rendered page will be added to the exclude list, we recommend to add your known pre-rendered pattern in the `nitro.cloudflare.pages.routes.exclude` option:
144
+
145
+
```ts [nuxt.config.ts]
146
+
exportdefaultdefineNuxtConfig({
147
+
// ...
148
+
nitro: {
149
+
cloudflare: {
150
+
pages: {
151
+
routes: {
152
+
exclude: [
153
+
// we know that all docs and blog pages are pre-rendered
154
+
'/docs/*',
155
+
'/blog/*'
156
+
]
157
+
}
158
+
}
159
+
}
160
+
}
161
+
})
162
+
```
163
+
135
164
## Caveats
136
165
137
166
If you are using authentication in your application such as [`nuxt-auth-utils`](https://github.com/Atinux/nuxt-auth-utils), you need to remember that the authentication state will not be available during the pre-rendering process.
0 commit comments