From 48f677de86f8e4607f779f1a2c6508d20103407b Mon Sep 17 00:00:00 2001 From: Felix Ruf Date: Fri, 2 Aug 2024 15:45:48 +0200 Subject: [PATCH] implemented lazy loading of views to reduce initial bundle size --- src/Resources/src/router.ts | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Resources/src/router.ts b/src/Resources/src/router.ts index a12fc1cf5..1516612ff 100644 --- a/src/Resources/src/router.ts +++ b/src/Resources/src/router.ts @@ -1,26 +1,26 @@ -import Dashboard from '@/views/Dashboard.vue'; -import Menu from '@/views/Menu.vue'; -import Dishes from '@/views/Dishes.vue'; -import Categories from '@/views/Categories.vue'; -import TimeSlots from '@/views/TimeSlots.vue'; -import Costs from '@/views/Costs.vue'; -import Finance from '@/views/Finance.vue'; -import Balance from '@/views/Balance.vue'; -import Guest from '@/views/Guest.vue'; -import NotAllowed from '@/views/NotAllowed.vue'; -import PrintableList from '@/views/PrintableList.vue'; -import ParticipantList from '@/views/ParticipantsList.vue'; -import Weeks from '@/views/Weeks.vue'; -import MenuParticipations from './views/MenuParticipations.vue'; -import CostsSettlement from './views/CostsSettlement.vue'; -import CashRegister from './views/CashRegister.vue'; -import Login from '@/views/Login.vue'; -import Events from './views/Events.vue'; -import GuestEvent from './views/GuestEvent.vue'; - import { createRouter, createWebHistory } from 'vue-router'; import { userDataStore } from '@/stores/userDataStore'; +const Dashboard = () => import('@/views/Dashboard.vue'); +const Menu = () => import('@/views/Menu.vue'); +const Dishes = () => import('@/views/Dishes.vue'); +const Categories = () => import('@/views/Categories.vue'); +const TimeSlots = () => import('@/views/TimeSlots.vue'); +const Costs = () => import('@/views/Costs.vue'); +const Finance = () => import('@/views/Finance.vue'); +const Balance = () => import('@/views/Balance.vue'); +const Guest = () => import('@/views/Guest.vue'); +const NotAllowed = () => import('@/views/NotAllowed.vue'); +const PrintableList = () => import('@/views/PrintableList.vue'); +const ParticipantList = () => import('@/views/ParticipantsList.vue'); +const Weeks = () => import('@/views/Weeks.vue'); +const MenuParticipations = () => import('@/views/MenuParticipations.vue'); +const CostsSettlement = () => import('@/views/CostsSettlement.vue'); +const CashRegister = () => import('@/views/CashRegister.vue'); +const Login = () => import('@/views/Login.vue'); +const Events = () => import('@/views/Events.vue'); +const GuestEvent = () => import('@/views/GuestEvent.vue'); + declare module 'vue-router' { interface RouteMeta { allowedRoles: Array;