Skip to content

Commit 04c4400

Browse files
authored
Merge pull request #312 from codex-team/dynamic-import-usage
2 parents 49b599f + 97cd07c commit 04c4400

File tree

4 files changed

+15
-22
lines changed

4 files changed

+15
-22
lines changed

src/application/error-catcher/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ declare global {
1515
*/
1616
const HawkPlugin = {
1717
install(app: App) {
18-
new HawkCatcher({
18+
const hawk = new HawkCatcher({
1919
token: import.meta.env.VITE_HAWK_TOKEN,
2020
vue: app,
2121
release: window.HAWK_RELEASE,
2222
});
23+
24+
app.config.globalProperties.$hawk = hawk;
2325
},
2426
};
2527

src/application/router/routes.ts

+10-19
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,7 @@
11
import Home from '@/presentation/pages/Home.vue';
22
import Note from '@/presentation/pages/Note.vue';
33
import Landing from '@/presentation/pages/Landing.vue';
4-
import Settings from '@/presentation/pages/Settings.vue';
5-
import NoteSettings from '@/presentation/pages/NoteSettings.vue';
6-
import ErrorPage from '@/presentation/pages/Error.vue';
7-
import JoinPage from '@/presentation/pages/Join.vue';
8-
import AuthorizationPage from '@/presentation/pages/AuthorizationPage.vue';
94
import type { RouteRecordRaw } from 'vue-router';
10-
import AddTool from '@/presentation/pages/marketplace/AddTool.vue';
11-
import MarketplacePage from '@/presentation/pages/marketplace/MarketplacePage.vue';
12-
import History from '@/presentation/pages/History.vue';
13-
import HistoryVersion from '@/presentation/pages/HistoryVersion.vue';
145
import MarketplaceTools from '@/presentation/pages/marketplace/MarketplaceTools.vue';
156

167
// Default production hostname for homepage. If different, then custom hostname used
@@ -48,7 +39,7 @@ const routes: RouteRecordRaw[] = [
4839
{
4940
name: 'history',
5041
path: '/note/:noteId/history',
51-
component: History,
42+
component: () => import('@/presentation/pages/History.vue'),
5243
meta: {
5344
layout: 'fullpage',
5445
pageTitleI18n: 'pages.history',
@@ -61,7 +52,7 @@ const routes: RouteRecordRaw[] = [
6152
{
6253
name: 'history_version',
6354
path: '/note/:noteId/history/:historyId',
64-
component: HistoryVersion,
55+
component: () => import('@/presentation/pages/HistoryVersion.vue'),
6556
meta: {
6657
layout: 'fullpage',
6758
pageTitleI18n: 'pages.historyVersion',
@@ -109,7 +100,7 @@ const routes: RouteRecordRaw[] = [
109100
{
110101
name: 'settings',
111102
path: `/settings/`,
112-
component: Settings,
103+
component: () => import('@/presentation/pages/Settings.vue'),
113104
meta: {
114105
pageTitleI18n: 'pages.userSettings',
115106
authRequired: true,
@@ -118,7 +109,7 @@ const routes: RouteRecordRaw[] = [
118109
{
119110
name: 'note_settings',
120111
path: '/note/:id/settings',
121-
component: NoteSettings,
112+
component: () => import('@/presentation/pages/NoteSettings.vue'),
122113
props: route => ({
123114
id: String(route.params.id),
124115
}),
@@ -130,7 +121,7 @@ const routes: RouteRecordRaw[] = [
130121
{
131122
name: 'marketplacePage',
132123
path: `/`,
133-
component: MarketplacePage,
124+
component: () => import('@/presentation/pages/marketplace/MarketplacePage.vue'),
134125
redirect: '/marketplace',
135126
meta: {
136127
pageTitleI18n: 'pages.marketplace',
@@ -147,7 +138,7 @@ const routes: RouteRecordRaw[] = [
147138
{
148139
name: 'marketplaceAddTool',
149140
path: `marketplace/add`,
150-
component: AddTool,
141+
component: () => import('@/presentation/pages/marketplace/AddTool.vue'),
151142
meta: {
152143
pageTitleI18n: 'pages.addTool',
153144
authRequired: true,
@@ -157,7 +148,7 @@ const routes: RouteRecordRaw[] = [
157148
{
158149
name: 'join',
159150
path: '/join/:hash',
160-
component: JoinPage,
151+
component: () => import('@/presentation/pages/Join.vue'),
161152
props: route => ({
162153
invitationHash: String(route.params.hash),
163154
}),
@@ -170,7 +161,7 @@ const routes: RouteRecordRaw[] = [
170161
{
171162
name: 'authorization',
172163
path: '/auth',
173-
component: AuthorizationPage,
164+
component: () => import('@/presentation/pages/AuthorizationPage.vue'),
174165
props: route => ({
175166
redirect: String(route.query.redirect),
176167
}),
@@ -184,7 +175,7 @@ const routes: RouteRecordRaw[] = [
184175
*/
185176
{
186177
path: '/:pathMatch(.*)*',
187-
component: ErrorPage,
178+
component: () => import('@/presentation/pages/Error.vue'),
188179
meta: {
189180
layout: 'fullpage',
190181
pageTitleI18n: 'pages.notFound',
@@ -199,7 +190,7 @@ const routes: RouteRecordRaw[] = [
199190
*/
200191
{
201192
path: '/error/:code',
202-
component: ErrorPage,
193+
component: () => import('@/presentation/pages/Error.vue'),
203194
meta: {
204195
layout: 'fullpage',
205196
pageTitleI18n: 'pages.error',

src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import '@/presentation/styles/index.pcss';
99

1010
const app = createApp(App);
1111

12+
app.use(hawk);
1213
app.use(createHead);
1314
app.use(router);
1415
app.use(i18n);
15-
app.use(hawk);
1616
app.mount('#app');

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"strict": true,
44
"types": ["vite/client"],
5-
"target": "ES2020",
5+
"target": "ES2022",
66
"baseUrl": "./src",
77
"useDefineForClassFields": true,
88
"module": "ESNext",

0 commit comments

Comments
 (0)