1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Feat lazy loading network (#2709)

Adds lazy loading to the network routes, so we end up with smaller
chunks in the build.

Also adds a `start:prod` script that can prove useful to test the chunk
loading behaviour locally.
This commit is contained in:
Nuno Góis 2022-12-16 18:09:24 +00:00 committed by GitHub
parent a3ac96f763
commit d2d5629a36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -13,6 +13,7 @@
"build": "vite build",
"lint": "yarn fmt:check",
"start": "vite",
"start:prod": "vite build && vite preview",
"start:sandbox": "UNLEASH_API=https://sandbox.getunleash.io/ospro yarn run start",
"start:enterprise": "UNLEASH_API=https://unleash4.herokuapp.com yarn run start",
"start:demo": "UNLEASH_BASE_PATH=/demo/ yarn start",

View File

@ -1,11 +1,13 @@
import { NetworkOverview } from './NetworkOverview/NetworkOverview';
import { NetworkTraffic } from './NetworkTraffic/NetworkTraffic';
import { lazy } from 'react';
import AdminMenu from '../menu/AdminMenu';
import { styled, Tab, Tabs } from '@mui/material';
import { Route, Routes, useLocation } from 'react-router-dom';
import { CenteredNavLink } from '../menu/CenteredNavLink';
import { PageContent } from 'component/common/PageContent/PageContent';
const NetworkOverview = lazy(() => import('./NetworkOverview/NetworkOverview'));
const NetworkTraffic = lazy(() => import('./NetworkTraffic/NetworkTraffic'));
const StyledPageContent = styled(PageContent)(() => ({
'.page-header': {
padding: 0,