Skip to content

Commit e87fafa

Browse files
authored
fix: router lazy loading 변경 (#192)
1 parent 44d2727 commit e87fafa

1 file changed

Lines changed: 24 additions & 45 deletions

File tree

src/router/index.js

Lines changed: 24 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,145 +1,124 @@
11
import { createRouter, createWebHistory } from 'vue-router'
22
import { getActivePinia } from 'pinia'
33
import { useAuthStore } from '@/stores/useAuthStore'
4-
import HomePage from '@/pages/HomePage.vue'
5-
import CompanionBoard from '@/pages/CompanionBoard.vue'
6-
import CommunityHome from '@/pages/CommunityHome.vue'
7-
import LoginPage from '@/pages/LoginPage.vue'
8-
import SignUpPage from '@/pages/SignUpPage.vue'
9-
import CommunityBoard from '@/pages/CommunityBoard.vue'
10-
import CallbacKkakao from '@/components/Auth/CallbacKkakao.vue'
11-
import CallbacNaver from '@/components/Auth/CallbacNaver.vue'
12-
import CommunityDetail from '@/pages/CommunityDetail.vue'
13-
import CompanionWrite from '@/pages/CompanionWrite.vue'
14-
import CommunityWrite from '@/pages/CommunityWrite.vue'
15-
import CompanionDetail from '@/pages/CompanionDetail.vue'
16-
import NotFound from '@/pages/NotFound.vue'
17-
import HotelReservation from '@/pages/HotelReservation.vue'
18-
import ProfilePage from '@/pages/ProfilePage.vue'
19-
import MyProfile from '@/pages/MyProfile.vue'
20-
import FollowPage from '@/pages/FollowPage.vue'
21-
import SettingPage from '@/pages/SettingPage.vue'
22-
import StoryPage from '@/pages/StoryPage.vue'
23-
import MyTripsPage from '@/pages/MyTripsPage.vue'
244

255
const router = createRouter({
266
history: createWebHistory(import.meta.env.BASE_URL),
277
routes: [
288
{
299
path: '/',
3010
name: 'home',
31-
component: HomePage,
11+
component: () => import('@/pages/HomePage.vue'),
3212
},
3313
{
3414
path: '/companion-board/:country',
3515
name: 'CompanionBoard',
36-
component: CompanionBoard,
37-
// props: true,
16+
component: () => import('@/pages/CompanionBoard.vue'),
3817
},
3918
{
4019
path: '/community-board/:country',
4120
name: 'CommmunityBoardPage',
42-
component: CommunityBoard,
21+
component: () => import('@/pages/CommunityBoard.vue'),
4322
},
4423
{
4524
path: '/community',
4625
name: 'Community',
47-
component: CommunityHome,
26+
component: () => import('@/pages/CommunityHome.vue'),
4827
},
4928
{
5029
path: '/login',
5130
name: 'login',
52-
component: LoginPage,
31+
component: () => import('@/pages/LoginPage.vue'),
5332
meta: { hideLayout: true },
5433
},
5534
{
5635
path: '/signup',
5736
name: 'signup',
58-
component: SignUpPage,
37+
component: () => import('@/pages/SignUpPage.vue'),
5938
meta: { hideLayout: true },
6039
},
6140
{
6241
path: '/login/callback/kakao',
6342
name: 'callbackkakao',
64-
component: CallbacKkakao,
43+
component: () => import('@/components/Auth/CallbacKkakao.vue'),
6544
},
6645
{
6746
path: '/login/callback/naver',
6847
name: 'callbacnaver',
69-
component: CallbacNaver,
48+
component: () => import('@/components/Auth/CallbacNaver.vue'),
7049
},
7150
{
72-
path: '/community/write', // 새 글 작성
51+
path: '/community/write',
7352
name: 'CommunityCreate',
74-
component: CommunityWrite,
53+
component: () => import('@/pages/CommunityWrite.vue'),
7554
},
76-
{
55+
{
7756
path: '/community/write/:country/edit/:id',
7857
name: 'CommunityEdit',
79-
component: CommunityWrite,
58+
component: () => import('@/pages/CommunityWrite.vue'),
8059
props: true,
8160
},
8261
{
8362
path: '/community/:id',
8463
name: 'CommunityDetail',
85-
component: CommunityDetail,
64+
component: () => import('@/pages/CommunityDetail.vue'),
8665
props: true,
8766
},
8867
{
8968
path: '/companion/write',
9069
name: 'CompanionCreate',
91-
component: CompanionWrite,
70+
component: () => import('@/pages/CompanionWrite.vue'),
9271
},
9372
{
9473
path: '/companion-board/:country/detail/:id',
9574
name: 'CompanionDetail',
96-
component: CompanionDetail,
75+
component: () => import('@/pages/CompanionDetail.vue'),
9776
props: true,
9877
},
9978
{
10079
path: '/companion/write/:country/edit/:id',
101-
component: CompanionWrite,
80+
component: () => import('@/pages/CompanionWrite.vue'),
10281
},
10382
{
10483
path: '/hotelreservation',
10584
name: 'HotelReservation',
106-
component: HotelReservation,
85+
component: () => import('@/pages/HotelReservation.vue'),
10786
},
10887
{
10988
path: '/:pathMatch(.*)*',
11089
name: 'NotFound',
111-
component: NotFound,
90+
component: () => import('@/pages/NotFound.vue'),
11291
meta: { hideLayout: true },
11392
},
11493
{
11594
path: '/mytripspage',
11695
name: 'MyTripsPage',
117-
component: MyTripsPage,
96+
component: () => import('@/pages/MyTripsPage.vue'),
11897
},
11998
{
12099
path: '/profile',
121100
name: 'ProfilePage',
122-
component: ProfilePage,
101+
component: () => import('@/pages/ProfilePage.vue'),
123102
children: [
124103
{
125104
path: '',
126105
name: 'MyProfile',
127-
component: MyProfile,
106+
component: () => import('@/pages/MyProfile.vue'),
128107
},
129108
{
130109
path: 'follow',
131110
name: 'FollowPage',
132-
component: FollowPage,
111+
component: () => import('@/pages/FollowPage.vue'),
133112
},
134113
{
135114
path: 'story',
136115
name: 'StoryPage',
137-
component: StoryPage,
116+
component: () => import('@/pages/StoryPage.vue'),
138117
},
139118
{
140119
path: 'setting',
141120
name: 'SettingPage',
142-
component: SettingPage,
121+
component: () => import('@/pages/SettingPage.vue'),
143122
},
144123
],
145124
},

0 commit comments

Comments
 (0)