Skip to content

Commit 6e84a1c

Browse files
mergify[bot]tthvo
andauthored
build(webpack): code-split bundles and add content-hash to output files (#588) (#596)
* build(bundle): add contenth hash to chunks * build(webpack): lazy load routes * fix(suspense): move Suspense to approriate place * build(webpack): prefetch bundles * build(webpack): exclude css from prefetch groups * build(webpack): exclude app and npm bundle * build(webpack): only prefetch lazy-load custom modules (cherry picked from commit ea89802) Co-authored-by: Thuan Vo <[email protected]>
1 parent 64a1f0a commit 6e84a1c

File tree

19 files changed

+122
-65
lines changed

19 files changed

+122
-65
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"prettier:check": "prettier --check './src/**/*.{tsx,ts}'",
2626
"prettier:apply": "prettier --write './src/**/*.{tsx,ts}'",
2727
"build:bundle-profile": "webpack --config webpack.prod.js --profile --json > stats.json",
28-
"build:bundle-analyze": "webpack-bundle-analyzer ./stats.json",
28+
"build:bundle-analyze": "webpack-bundle-analyzer ./stats.json dist",
2929
"build:bundle-profile-analyze": "npm-run-all -l build:bundle-profile build:bundle-analyze",
3030
"yarn:install": "yarn install",
3131
"yarn:frzinstall": "yarn install --frozen-lockfile"
@@ -43,6 +43,7 @@
4343
"@types/victory": "^33.1.5",
4444
"@typescript-eslint/eslint-plugin": "^4.32.0",
4545
"@typescript-eslint/parser": "^4.32.0",
46+
"@vue/preload-webpack-plugin": "^2.0.0",
4647
"css-loader": "^5.2.6",
4748
"css-minimizer-webpack-plugin": "^4.0.0",
4849
"dotenv-webpack": "^7.1.0",

src/app/About/About.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ import { BreadcrumbPage } from '@app/BreadcrumbPage/BreadcrumbPage';
4343
import { AboutDescription, CRYOSTAT_TRADEMARK } from './AboutDescription';
4444
import { Brand, Card, CardBody, CardFooter, CardHeader } from '@patternfly/react-core';
4545

46-
export const About = () => {
46+
export interface AboutProps {}
47+
48+
export const About: React.FunctionComponent<AboutProps> = (props) => {
4749
return (
4850
<BreadcrumbPage pageTitle="About">
4951
<Card>
@@ -58,3 +60,5 @@ export const About = () => {
5860
</BreadcrumbPage>
5961
);
6062
};
63+
64+
export default About;

src/app/Archives/Archives.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export const uploadAsTarget: Target = {
6262

6363
export interface ArchivesProps {}
6464

65-
export const Archives: React.FunctionComponent<ArchivesProps> = () => {
65+
export const Archives: React.FunctionComponent<ArchivesProps> = (props) => {
6666
const context = React.useContext(ServiceContext);
6767
const addSubscription = useSubscriptions();
6868
const [activeTab, setActiveTab] = React.useState(0);
@@ -103,3 +103,5 @@ export const Archives: React.FunctionComponent<ArchivesProps> = () => {
103103
</BreadcrumbPage>
104104
);
105105
};
106+
107+
export default Archives;

src/app/CreateRecording/CreateRecording.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,4 @@ const Comp: React.FunctionComponent<RouteComponentProps<{}, StaticContext, Creat
121121
};
122122

123123
export const CreateRecording = withRouter(Comp);
124+
export default CreateRecording;

src/app/Dashboard/Dashboard.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
import * as React from 'react';
3939
import { TargetView } from '@app/TargetView/TargetView';
4040

41-
export const Dashboard = () => {
41+
export interface DashboardProps {}
42+
43+
export const Dashboard: React.FunctionComponent<DashboardProps> = (props) => {
4244
return <TargetView pageTitle="Dashboard" compactSelect={true} />;
4345
};
46+
47+
export default Dashboard;

src/app/Events/Events.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,5 @@ export const Events: React.FunctionComponent<EventsProps> = (props) => {
118118
</>
119119
);
120120
};
121+
122+
export default Events;

src/app/LoadingView/LoadingView.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
import * as React from 'react';
3939
import { Bullseye, Spinner } from '@patternfly/react-core';
4040

41-
export const LoadingView: React.FunctionComponent = () => {
41+
export interface LoadingViewProps {}
42+
43+
export const LoadingView: React.FunctionComponent<LoadingViewProps> = (props) => {
4244
return (
4345
<>
4446
<br />
@@ -48,3 +50,5 @@ export const LoadingView: React.FunctionComponent = () => {
4850
</>
4951
);
5052
};
53+
54+
export default LoadingView;

src/app/Login/Login.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ import { NoopAuthForm } from './NoopAuthForm';
4545
import { ConnectionError } from './ConnectionError';
4646
import { AuthMethod } from '@app/Shared/Services/Login.service';
4747

48-
export const Login = () => {
48+
export interface LoginProps {}
49+
50+
export const Login: React.FunctionComponent<LoginProps> = (props) => {
4951
const serviceContext = React.useContext(ServiceContext);
5052
const notifications = React.useContext(NotificationsContext);
5153
const [authMethod, setAuthMethod] = React.useState('');
@@ -109,3 +111,5 @@ export const Login = () => {
109111
</PageSection>
110112
);
111113
};
114+
115+
export default Login;

src/app/NotFound/NotFound.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ import '@app/app.css';
5050
import { MapMarkedAltIcon } from '@patternfly/react-icons';
5151
import { IAppRoute, routes, flatten } from '@app/routes';
5252

53-
const NotFound: React.FunctionComponent = () => {
53+
export interface NotFoundProps {}
54+
55+
export const NotFound: React.FunctionComponent<NotFoundProps> = (props) => {
5456
const cards = flatten(routes)
5557
.filter((route: IAppRoute): boolean => !!route.description)
5658
.sort((a: IAppRoute, b: IAppRoute): number => a.title.localeCompare(b.title))
@@ -80,4 +82,4 @@ const NotFound: React.FunctionComponent = () => {
8082
);
8183
};
8284

83-
export { NotFound };
85+
export default NotFound;

src/app/Recordings/Recordings.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ import { ActiveRecordingsTable } from './ActiveRecordingsTable';
4343
import { ArchivedRecordingsTable } from './ArchivedRecordingsTable';
4444
import { useSubscriptions } from '@app/utils/useSubscriptions';
4545

46-
export const Recordings = () => {
46+
export interface RecordingsProps {}
47+
48+
export const Recordings: React.FunctionComponent<RecordingsProps> = (props) => {
4749
const context = React.useContext(ServiceContext);
4850
const [activeTab, setActiveTab] = React.useState(0);
4951
const [archiveEnabled, setArchiveEnabled] = React.useState(false);
@@ -81,3 +83,5 @@ export const Recordings = () => {
8183
</TargetView>
8284
);
8385
};
86+
87+
export default Recordings;

0 commit comments

Comments
 (0)