Skip to content

Commit 76061ba

Browse files
committed
deployment checks#002
1 parent 0063b15 commit 76061ba

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

app/api/login/route.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { NextResponse } from 'next/server'
2-
import { PrismaClient } from '@prisma/client'
2+
import { prisma } from '@/lib/prisma'
33
import { cookies } from 'next/headers'
44

5-
const prisma = new PrismaClient()
5+
66

77
export async function POST(request: Request) {
88
const { username, password } = await request.json()

lib/prisma.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { PrismaClient } from '@prisma/client'
2+
3+
const globalForPrisma = global as unknown as {
4+
prisma: PrismaClient | undefined
5+
}
6+
7+
export const prisma =
8+
globalForPrisma.prisma ??
9+
new PrismaClient({
10+
log: ['query'],
11+
})
12+
13+
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma

next.config.mjs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {};
3-
4-
export default nextConfig;
2+
const nextConfig = {
3+
experimental: {
4+
serverComponentsExternalPackages: ['@prisma/client'],
5+
},
6+
};
7+
8+
export default nextConfig;

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint"
9+
"lint": "next lint",
10+
"vercel-build": "prisma generate && next build"
1011
},
1112
"prisma": {
1213
"seed": "ts-node prisma/seed.ts"

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"name": "next"
1818
}
1919
],
20+
"baseUrl": ".",
2021
"paths": {
2122
"@/*": ["./*"]
2223
}

0 commit comments

Comments
 (0)