forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Reduce initial bundle size (elastic#78992)
* Load the redux store factory and initial state factory lazily * Combine certain dynamic imports to reduce total async bundle size (this works because shared dependencies between async chunks are not being de-duped by Webpack.) * Add explicit types in some areas. Co-authored-by: Xavier Mouligneau <189600+XavierM@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
296 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
x-pack/plugins/security_solution/public/lazy_application_dependencies.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/** | ||
* the plugin (defined in `plugin.tsx`) has many dependencies that can be loaded only when the app is being used. | ||
* By loading these later we can reduce the initial bundle size and allow users to delay loading these dependencies until they are needed. | ||
*/ | ||
|
||
import { renderApp } from './app'; | ||
import { composeLibs } from './common/lib/compose/kibana_compose'; | ||
|
||
import { createStore, createInitialState } from './common/store'; | ||
|
||
export { renderApp, composeLibs, createStore, createInitialState }; |
32 changes: 32 additions & 0 deletions
32
x-pack/plugins/security_solution/public/lazy_sub_plugins.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
/** | ||
* the plugin (defined in `plugin.tsx`) has many dependencies that can be loaded only when the app is being used. | ||
* By loading these later we can reduce the initial bundle size and allow users to delay loading these dependencies until they are needed. | ||
*/ | ||
|
||
import { Detections } from './detections'; | ||
import { Cases } from './cases'; | ||
import { Hosts } from './hosts'; | ||
import { Network } from './network'; | ||
import { Overview } from './overview'; | ||
import { Timelines } from './timelines'; | ||
import { Management } from './management'; | ||
|
||
/** | ||
* The classes used to instantiate the sub plugins. These are grouped into a single object for the sake of bundling them in a single dynamic import. | ||
*/ | ||
const subPluginClasses = { | ||
Detections, | ||
Cases, | ||
Hosts, | ||
Network, | ||
Overview, | ||
Timelines, | ||
Management, | ||
}; | ||
export { subPluginClasses }; |
Oops, something went wrong.