Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ fix ] cloudflare deployment #24

Merged
merged 1 commit into from
Jun 6, 2024
Merged

[ fix ] cloudflare deployment #24

merged 1 commit into from
Jun 6, 2024

Conversation

soomin9106
Copy link
Collaborator

🔥 Related Issues

resolve #issue_number
close #issue_number

💜 작업 내용

  • Next.js 최신 기능 (app router, server component 등) 지원하는 npm 패키지 사용해서 배포 시키기

✅ PR Point

  • next export 제거했습니다!
  • @cloudflare/next-on-pages 빌드 명령어 사용해서 배포합니다

😡 Trouble Shooting

👀 스크린샷 / GIF / 링크

스크린샷 2024-06-06 오후 2 26 24

📚 Reference

@@ -1,6 +1,5 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export",
reactStrictMode: true,
webpack: (config) => {
config.module.rules.push({
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

babel-loader 설정을 더욱 강화하면 코드 최적화에 도움이 될 수 있습니다. 예를 들어, exclude 옵션을 추가하여 node_modules와 같은 필요 없는 디렉토리를 제외할 수 있습니다.

혹시 아직 적용하지 않았다면 런타임 확인과 ESlint 통합을 위해 'reactStrictMode'를 true로 설정해둔 것이 좋습니다.

코드의 output 속성이 제거된 이유가 궁금합니다. 이 속성은 다음과 같이 출력 파일명을 결정하는 데 사용할 수 있는 속성입니다:

output: {
    filename: '[name].bundle.js',
    path: path.resolve(__dirname, 'dist'),
}

만약 이 수정이 의도적이라면 문제는 없지만 실수로 삭제되었다면 이를 확인하는 것이 중요합니다.

@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build & next export",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드 패치는 next.js 프로젝트의 NPM 스크립트를 수정합니다. "next build & next export"가 "next build" 로 변경되었습니다. 이것은 다음과 같은 효과가 있습니다.

  1. 버그 위험: 다음 빌드 이후에 next export 명령을 실행하지 않게 되므로, 정적 HTML 출시를 기대하는 경우 오류가 발생할 수 있습니다. 따라서 이 변경이 적절한지는 프로젝트의 배포 요구 사항과 관련이 있습니다.

  2. 개선 제안: 만약 이 패치가 의도적으로 일어난 것이라면, 그 이유를 고려하고 주석으로 명확히 나타내는 것이 좋습니다. 이는 팀원들이 변경사항을 이해하는데 도움이 됩니다. 또한, next export이 아직 필요한 곳이 있다면 별도의 스크립트를 추가하는 것을 고려해보세요.

  3. 안정성: 모든 코드 변경에 대해 테스트를 실시하여 예상하지 못한 문제를 방지하는 것이 중요합니다. 때문에 테스트 및 검증 절차를 실시해 애플리케이션이 잘 작동하는지 확인해야 합니다. 이는 특히 프로덕션 레벨 코드에서 중요합니다.

@Happhee
Copy link
Collaborator

Happhee commented Jun 6, 2024

지금이라도 발견해서 진짜 다행이다 ㅎㅎㅎ 고생했어 숨나!

@soomin9106 soomin9106 merged commit a86d94c into main Jun 6, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants