Skip to content

Commit

Permalink
edge prerendering on Cloudflare ⚡
Browse files Browse the repository at this point in the history
- deleted `not-found.tsx` per cloudflare/next-on-pages#413 and cloudflare/next-on-pages#174
- added `export const runtime = 'edge';` to all `layout.tsx` files
  • Loading branch information
adamstambouli committed Jan 23, 2024
1 parent ac0e367 commit 2acc0f9
Show file tree
Hide file tree
Showing 22 changed files with 3,191 additions and 3,458 deletions.
2 changes: 2 additions & 0 deletions app/context/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { CounterProvider } from 'app/context/counter-context';
import React from 'react';
import ContextClickCounter from './context-click-counter';

export const runtime = 'edge';

const title = 'Client Context';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/error-handling/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ClickCounter } from '#/ui/click-counter';
import { TabGroup } from '#/ui/tab-group';
import React from 'react';

export const runtime = 'edge';

const title = 'Error Handling';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/hooks/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { ClickCounter } from '#/ui/click-counter';
import { TabGroup } from '#/ui/tab-group';
import React from 'react';

export const runtime = 'edge';

const title = 'Hooks';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/isr/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { TabGroup } from '#/ui/tab-group';
import React from 'react';

export const runtime = 'edge';

const title = 'Incremental Static Regeneration (ISR)';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import Byline from '#/ui/byline';
import { GlobalNav } from '#/ui/global-nav';
import { Metadata } from 'next';

export const runtime = 'edge';

export const metadata: Metadata = {
title: {
default: 'Next.js App Router',
Expand Down
2 changes: 2 additions & 0 deletions app/layouts/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ClickCounter } from '#/ui/click-counter';
import { TabGroup } from '#/ui/tab-group';
import React from 'react';

export const runtime = 'edge';

const title = 'Nested Layouts';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/loading/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { TabGroup } from '#/ui/tab-group';
import { notFound } from 'next/navigation';
import React from 'react';

export const runtime = 'edge';

const title = 'Loading';

export const metadata = {
Expand Down
13 changes: 0 additions & 13 deletions app/not-found.tsx

This file was deleted.

2 changes: 2 additions & 0 deletions app/not-found/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ClickCounter } from '#/ui/click-counter';
import { TabGroup } from '#/ui/tab-group';
import React from 'react';

export const runtime = 'edge';

const title = 'Not Found';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/parallel-routes/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const runtime = 'edge';

const title = 'Parallel Routes';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/route-groups/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';

export const runtime = 'edge';

const title = 'Route Groups';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/snippets/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const runtime = 'edge';

const title = 'Snippets';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/ssg/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Tab } from '#/ui/tab';
import React from 'react';
import { RandomPostTab } from './random-post-tab';

export const runtime = 'edge';

const title = 'Static Data';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/ssr/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { TabGroup } from '#/ui/tab-group';
import React from 'react';

export const runtime = 'edge';

const title = 'Dynamic Data';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/streaming/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { TabGroup } from '#/ui/tab-group';
import React from 'react';

export const runtime = 'edge';

const title = 'Streaming';

export const metadata = {
Expand Down
2 changes: 2 additions & 0 deletions app/styling/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { TabGroup } from '#/ui/tab-group';
import React from 'react';

export const runtime = 'edge';

const title = 'Styling';

export const metadata = {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"vercel": "30.2.1"
},
"devDependencies": {
"@cloudflare/next-on-pages": "1.8.5",
"@tailwindcss/forms": "0.5.3",
"@tailwindcss/typography": "0.5.9",
"@types/ms": "0.7.31",
Expand Down
Loading

0 comments on commit 2acc0f9

Please sign in to comment.