Skip to content

chore: rollup-plugin-visualizer 설치 및 성능 유지를 위한 조건부 빌드 설정#195

Merged
xaexunxang merged 1 commit intodevelopfrom
chore/#194/rollup-plugin-visualizer-set
Jun 24, 2025
Merged

chore: rollup-plugin-visualizer 설치 및 성능 유지를 위한 조건부 빌드 설정#195
xaexunxang merged 1 commit intodevelopfrom
chore/#194/rollup-plugin-visualizer-set

Conversation

@xaexunxang
Copy link
Copy Markdown
Contributor

@xaexunxang xaexunxang commented Jun 23, 2025

프론트엔드 번들 사이즈 확인 (analyze.html)

image

기타 사항

  • 분석 시각화 플러그인은 빌드 시간에 영향을 주기 때문에 yarn build:analyze 할 때만 실행되도록 조건부 빌드 설정
  • 추후 Code Splitting을 위한 코드 주석 처리

문제점

  • 모든 코드가 하나의 JS 번들로 묶여서 로딩되고 있음
  • 초기 로딩 속도에 큰 영향으로 다음과 같은 전략을 적용해야함

번들 최적화 전략

  • dynamic import : 필요한 시점에 라이브러리 로드
  • loadsh individual import : 필요한 번들만 개별적으로 임포트
  • use manualChunks : 특정 모듈들을 직접 지정하여 청크단위로 나눔

목적

  1. 초기 로딩 최소화
  2. 청크 캐싱 최적화
  3. 네트워크 병렬 처리

Summary by CodeRabbit

  • New Features

    • 번들 분석을 위한 빌드 명령어(build:analyze)가 추가되었습니다. 실행 시 번들 구조 시각화 리포트가 자동으로 생성됩니다.
  • Chores

    • 번들 시각화 도구가 개발 의존성으로 추가되었습니다.
    • 빌드 결과에 소스맵이 포함되도록 설정이 개선되었습니다.

@xaexunxang xaexunxang requested a review from Yejiin21 June 23, 2025 16:53
@xaexunxang xaexunxang self-assigned this Jun 23, 2025
@xaexunxang xaexunxang added the 👨‍🔧 Chore 환경 설정 label Jun 23, 2025
@xaexunxang xaexunxang linked an issue Jun 23, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jun 23, 2025

Walkthrough

Vite 빌드 시 번들 분석을 위한 rollup-plugin-visualizer가 개발 의존성으로 추가되었고, ANALYZE=true 환경 변수로 활성화되는 build:analyze 스크립트가 도입되었습니다. Vite 설정 파일에 플러그인 및 소스맵 옵션이 조건부로 적용되어 분석 결과를 시각화할 수 있습니다.

Changes

파일/경로 변경 요약
package.json rollup-plugin-visualizer 개발 의존성 추가, build:analyze 스크립트 추가
vite.config.ts visualizer 플러그인 조건부 적용, 소스맵 활성화, 코드 스플리팅 주석 추가

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant NPM_Script
    participant Vite
    participant Visualizer

    Developer->>NPM_Script: npm run build:analyze
    NPM_Script->>Vite: ANALYZE=true vite build
    Vite->>Visualizer: (ANALYZE=true) 플러그인 활성화
    Visualizer->>Vite: 번들 분석 및 analyze.html 생성
    Vite->>Developer: 분석 결과 브라우저로 자동 오픈
Loading

Possibly related issues

Poem

번들 속 비밀을 파헤치며
분석 토끼가 뛰어다녀요!
한눈에 쏙, 시각화된 트리맵
"npm run build:analyze" 한 번이면
코드 숲이 환하게 열려요.
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
vite.config.ts (1)

56-66: 빌드 설정 개선과 미래 계획이 잘 반영되었습니다.

소스맵 활성화는 번들 분석에 도움이 되며, 주석 처리된 manual chunks 설정은 향후 코드 분할 최적화를 위한 좋은 준비입니다. React와 React Router를 별도 청크로 분리하는 전략이 합리적입니다.

향후 코드 분할 적용 시 다음 사항들을 고려해보세요:

  • lodash와 같은 유틸리티 라이브러리도 별도 청크로 분리
  • 라우트 기반 코드 분할 적용
  • 청크 크기 최적화를 위한 임계값 설정
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7337610 and c9e9749.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (2)
  • package.json (2 hunks)
  • vite.config.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: storybook
🔇 Additional comments (5)
package.json (2)

9-9: 번들 분석 스크립트가 적절하게 구성되었습니다.

ANALYZE=true 환경변수를 통해 조건부로 번들 분석을 활성화하는 방식이 깔끔하고 효율적입니다. 개발자가 필요할 때만 분석 도구를 실행할 수 있어 성능상 이점이 있습니다.


68-68: rollup-plugin-visualizer 의존성 추가를 승인합니다.

버전 ^6.0.3은 안정적인 버전이며, 개발 의존성으로 분류되어 프로덕션 번들에 영향을 주지 않습니다. 번들 시각화 분석에 적합한 선택입니다.

vite.config.ts (3)

1-1: 필요한 import 구문이 적절하게 추가되었습니다.

PluginOption 타입과 visualizer 플러그인을 위한 import가 정확히 추가되어 타입 안전성과 기능 구현을 지원합니다.

Also applies to: 7-7


12-12: 환경변수 기반 조건부 활성화가 효율적입니다.

process.env.ANALYZE 체크를 통해 분석 모드를 제어하는 방식이 명확하고 성능에 최적화되어 있습니다.


17-30: visualizer 플러그인 설정이 포괄적이고 잘 구성되었습니다.

조건부 플러그인 로딩 구현이 훌륭하며, visualizer 설정 옵션들이 번들 분석에 최적화되어 있습니다:

  • treemap 템플릿으로 직관적인 시각화
  • gzip/brotli 압축 크기 분석 포함
  • 자동 브라우저 열기로 사용자 경험 향상
  • PluginOption 타입 캐스팅으로 타입 안전성 확보

@xaexunxang xaexunxang merged commit 8ba4f5d into develop Jun 24, 2025
2 checks passed
@xaexunxang xaexunxang deleted the chore/#194/rollup-plugin-visualizer-set branch June 24, 2025 05:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

👨‍🔧 Chore 환경 설정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[chore] rollup-plugin-visualizer 설정 테스트

2 participants