-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
Description
概要
#43 で Better Auth の認証実装方法を変更したため、不要になった独自認証APIや関連コードを特定してクリーンアップする。
🎯 目標
- バンドルサイズを 500KB以下 に削減
- 不要コード・型定義の完全除去
- Tree-shaking の最適化
🔍 調査・削除対象
1. 独自認証API関数
-
src/lib/api.ts
のsignIn()
,signUp()
,signOut()
,getSession()
- 関連するimport文・型定義
2. 未使用型定義
-
shared/types.ts
のLoginCredentials
,RegisterCredentials
-
AuthResponse
の簡略化 - Zodスキーマの未使用部分
3. デッドコード
- 未使用のimport文
- 使用されていないユーティリティ関数
- 古い認証関連のコンポーネント
🛠️ 実装タスク
Phase 1: 調査・分析
- Bundle Analyzer でボトルネック特定
- 不要コード検出スクリプト実行
- TypeScript unused import チェック
Phase 2: コード削除
- 独自認証API関数削除
- 未使用型定義削除
- デッドコード除去
Phase 3: 最適化
- Tree-shaking設定確認
- Dynamic import検討
- Vite設定の最適化
📊 成功指標
- バンドルサイズ: 647KB → 500KB以下 (20%削減)
- Gzipサイズ: 197KB → 150KB以下
- ビルド警告: 除去完了
- 機能: 既存機能の完全動作
🧪 テスト計画
- 全ページの動作確認
- 認証フロー確認
- ビルドエラーなし
- 型エラーなし
📚 参考資料
優先度
Medium - 機能に影響しないが、パフォーマンス改善のため
Related to #37 (Bundle Size最適化)
ワークフロー
# 1. ブランチ作成
git switch -c cleanup/unused-code-after-better-auth
# 2. Bundle Analyzer 実行・分析
bun add -D vite-bundle-analyzer
bunx vite-bundle-analyzer
# 3. 段階的コミット
git commit -m "analysis: Add bundle analyzer results"
git commit -m "cleanup: Remove unused auth API functions"
git commit -m "cleanup: Remove unused type definitions"
git commit -m "optimize: Configure tree-shaking settings"
# 4. 最終確認・プルリクエスト
ブランチ名
cleanup/unused-code-after-better-auth