Skip to content

Commit

Permalink
feat: make it easier to try edge runtime in the app router
Browse files Browse the repository at this point in the history
  • Loading branch information
ixartz committed Aug 30, 2023
1 parent d94f152 commit 3f5fd58
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ export default function RootLayout({
</html>
);
}

// Enable edge runtime but you are required to disable the `migrate` function in `src/libs/DB.ts`
// export const runtime = 'edge';
1 change: 1 addition & 0 deletions src/libs/DB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const client = createClient({

export const db = drizzle(client);

// Disable migrate function if using Edge runtime and use `npm run db:push` instead
if (process.env.NODE_ENV !== 'production') {
await migrate(db, { migrationsFolder: './migrations' });
}
1 change: 0 additions & 1 deletion src/libs/Env.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable import/prefer-default-export */
import { createEnv } from '@t3-oss/env-nextjs';
import process from 'process';
import { z } from 'zod';

// Don't add NODE_ENV into T3 Env, it changes the tree-shaking behavior
Expand Down

0 comments on commit 3f5fd58

Please sign in to comment.