본문 바로가기

next.js133

Next.js13 프로젝트에서 yarn start(or npm run start) 스크립트를 실행했을 때 실행되는 코드 분석 Next.js - next-start code #!/usr/bin/env node import arg from 'next/dist/compiled/arg/index.js' import { startServer } from '../server/lib/start-server' import { getPort, printAndExit } from '../server/lib/utils' import isError from '../lib/is-error' import { getProjectDir } from '../lib/get-project-dir' import { CliCommand } from '../lib/commands' import { resolve } from 'path' import { PHASE_P.. 2023. 6. 28.
Next.js 13 에서 NextResponse 사용 방법 해당 글은 App Router 방식을 따르고 있습니다. cookies response의 Set-Cookie 헤더를 읽거나 변경한다. set(name, value) name과 value에 값을 넣어 쿠키를 설정한다. // /home 들어오는 요청이 주어지면 let response = NextResponse.next(); // 배너를 숨기도록 쿠키 설정 response.cookies.set('show-banner', 'false; HttpOnly; Secure;'); // 옵션은 값 옆에 ; 을 붙이면 된다 // 위 코드는 Response에 `Set-Cookie:show-banner=false; HttpOnly; Secure; path=/home` 헤더가 있다와 같은 말이다. return response; .. 2023. 5. 17.
[ERROR] Vercel 배포시 Prisma 에러 - 해결 해당 글은 Next.js 13.2.4 버전 기준입니다. Next.js에서 Prisma를 채택해서 배포했을 때, 해당 에러가 떴었다. 🤔 Vercel 빌드하며 난 에러 문구 PrismaClientInitializationError: Prisma has detected that this project was built on Vercel, which caches dependencies. This leads to an outdated Prisma Client because Prisma's auto-generation isn't triggered. To fix this, make sure to run the `prisma generate` command during the build process. 간단히 말하면.. 2023. 5. 15.