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

동적 임포트를 제거해본다 #158

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { Routes, Route, Navigate } from 'react-router-dom';
import './index.css';
import { ProtectedRoute } from './components/route/ProtectedRoute';
import { lazy } from 'react';
import { AfterLoginLayout } from './components/common/AfterLoginLayout';
import { LazyRoute } from './components/common/LazyRoute';
import { useAuth } from './contexts/AuthContext';
import StatsPage from './components/pages/stats/StatsPage';
const RecentBoard = lazy(() => import('./components/pages/board/RecentBoard'));
const LoginPage = lazy(() => import('./components/pages/login/LoginPage'));
const BoardPage = lazy(() => import('./components/pages/board/BoardPage'));
const PostDetailPage = lazy(() => import('./components/pages/post/PostDetailPage'));
const AccountPage = lazy(() => import('./components/pages/account/AccountPage'));
const EditAccountPage = lazy(() => import('./components/pages/account/EditAccountPage'));
const NotificationsPage = lazy(() => import('./components/pages/notification/NotificationsPage'));
const NotificationSettingPage = lazy(() => import('./components/pages/notification/NotificationSettingPage'));
const PostCreationPage = lazy(() => import('./components/pages/post/PostCreationPage'));
const PostEditPage = lazy(() => import('./components/pages/post/PostEditPage'));
const BoardListPage = lazy(() => import('./components/pages/board/BoardListPage'));

// 동적 임포트를 일반 임포트로 변경
import RecentBoard from './components/pages/board/RecentBoard';
import LoginPage from './components/pages/login/LoginPage';
import BoardPage from './components/pages/board/BoardPage';
import PostDetailPage from './components/pages/post/PostDetailPage';
import AccountPage from './components/pages/account/AccountPage';
import EditAccountPage from './components/pages/account/EditAccountPage';
import NotificationsPage from './components/pages/notification/NotificationsPage';
import NotificationSettingPage from './components/pages/notification/NotificationSettingPage';
import PostCreationPage from './components/pages/post/PostCreationPage';
import PostEditPage from './components/pages/post/PostEditPage';
import BoardListPage from './components/pages/board/BoardListPage';

export default function App() {
const { currentUser } = useAuth();
Expand All @@ -25,7 +25,7 @@ export default function App() {
<Routes>
<Route path='/login' element={
!currentUser ? (
<LazyRoute element={LoginPage} />
<LoginPage />
) : (
<Navigate to='/boards' replace />
)
Expand All @@ -36,17 +36,17 @@ export default function App() {
<AfterLoginLayout />
</ProtectedRoute>
}>
<Route path='/boards' element={<LazyRoute element={RecentBoard} />} />
<Route path='/boards/list' element={<LazyRoute element={BoardListPage} />} />
<Route path='/board/:boardId' element={<LazyRoute element={BoardPage} />} />
<Route path='/create/:boardId' element={<LazyRoute element={PostCreationPage} />} />
<Route path='/board/:boardId/post/:postId' element={<LazyRoute element={PostDetailPage} />} />
<Route path='/board/:boardId/edit/:postId' element={<LazyRoute element={PostEditPage} />} />
<Route path='/notifications' element={<LazyRoute element={NotificationsPage} />} />
<Route path='/notifications/settings' element={<LazyRoute element={NotificationSettingPage} />} />
<Route path='/account' element={<LazyRoute element={AccountPage} />} />
<Route path='/account/edit' element={<LazyRoute element={EditAccountPage} />} />
<Route path='/stats' element={<LazyRoute element={StatsPage} />} />
<Route path='/boards' element={<RecentBoard />} />
<Route path='/boards/list' element={<BoardListPage />} />
<Route path='/board/:boardId' element={<BoardPage />} />
<Route path='/create/:boardId' element={<PostCreationPage />} />
<Route path='/board/:boardId/post/:postId' element={<PostDetailPage />} />
<Route path='/board/:boardId/edit/:postId' element={<PostEditPage />} />
<Route path='/notifications' element={<NotificationsPage />} />
<Route path='/notifications/settings' element={<NotificationSettingPage />} />
<Route path='/account' element={<AccountPage />} />
<Route path='/account/edit' element={<EditAccountPage />} />
<Route path='/stats' element={<StatsPage />} />
</Route>

<Route path='/' element={
Expand Down