ui(server): lazy load server console to reduce main bundle size

This commit is contained in:
Matthew Penner 2023-01-25 11:39:07 -07:00
parent 7c67ff3711
commit d8b7747828
No known key found for this signature in database

View file

@ -1,7 +1,6 @@
import type { ComponentType } from 'react'; import type { ComponentType } from 'react';
import { lazy } from 'react'; import { lazy } from 'react';
import ServerConsole from '@/components/server/console/ServerConsoleContainer';
import DatabasesContainer from '@/components/server/databases/DatabasesContainer'; import DatabasesContainer from '@/components/server/databases/DatabasesContainer';
import ScheduleContainer from '@/components/server/schedules/ScheduleContainer'; import ScheduleContainer from '@/components/server/schedules/ScheduleContainer';
import UsersContainer from '@/components/server/users/UsersContainer'; import UsersContainer from '@/components/server/users/UsersContainer';
@ -21,6 +20,7 @@ import ServerActivityLogContainer from '@/components/server/ServerActivityLogCon
// //
// These specific lazy loaded routes are to avoid loading in heavy screens // These specific lazy loaded routes are to avoid loading in heavy screens
// for the server dashboard when they're only needed for specific instances. // for the server dashboard when they're only needed for specific instances.
const ServerConsoleContainer = lazy(() => import('@/components/server/console/ServerConsoleContainer'));
const FileEditContainer = lazy(() => import('@/components/server/files/FileEditContainer')); const FileEditContainer = lazy(() => import('@/components/server/files/FileEditContainer'));
const ScheduleEditContainer = lazy(() => import('@/components/server/schedules/ScheduleEditContainer')); const ScheduleEditContainer = lazy(() => import('@/components/server/schedules/ScheduleEditContainer'));
@ -86,7 +86,7 @@ export default {
path: '', path: '',
permission: null, permission: null,
name: 'Console', name: 'Console',
component: ServerConsole, component: ServerConsoleContainer,
end: true, end: true,
}, },
{ {