https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
File Conventions: Route Segment Config | Next.js
Learn about how to configure options for Next.js route segments.
nextjs.org
next.js에서는 route segment와 관련된 방식이 여러가지 있는데 기본적으로는 ' auto'로 설정되어 있다
npm run dev에서는 정상적으로 api호출 시 변경된 값이 잘 반영이 되는데
npm build후 start를 진행하면 api호출값이 고정되며 변경되지 않는 이슈가 발생
이를 방지하기 위해 layout.jsx | page.jsx | route.jsx(.js|.tsx|.ts가능) 에 다음 값을 넣어준다
export const dynamic = 'force-dynamic'
// 'auto' | 'force-dynamic' | 'error' | 'force-static'
처리하고 나면 build후에도 정상적으로 api통신이 이루어지는 것을 확인할 수 있다
'Node' 카테고리의 다른 글
npm i registry 관련 404 error (0) | 2025.04.03 |
---|---|
nodejs child process (0) | 2024.10.04 |
프로그램 에러 테스트 순서 (0) | 2024.09.27 |
PM2 access denied // node 에서 실행 시 정상 실행 원인 (0) | 2024.09.09 |
node 프로그램 내부 MQTT reconnect관련 문제 (0) | 2024.07.11 |