Improve JS Initialisation Performance for each page
This is a collection of issues improving the performance of the main JS initialisation that is happening on each page. To improve it we need to reduce the bundle size of `main.js` and reduce the main workload of initialisation calls that is happening on each page.
# Initialisation Calls
## Deferring workload
[Moving not so important calls to a idleCallback execution](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/24190) :heavy\_check\_mark:
## Remove / Make workload page
main.js - `DomContentLoaded` (Sorted by biggest impact atm)
* [Improve localtimeago rendering](https://gitlab.com/gitlab-org/gitlab-ce/issues/56327) :heavy\_check\_mark:
* [Improve Initialization in layout_nav](gitlab-org/gitlab-ce#56257) :heavy\_check\_mark:
Other Initialisations
* [Frequent Items Initialisations can be optimised and deferred in idleCallback](https://gitlab.com/gitlab-org/gitlab-ce/issues/56328) :heavy\_check\_mark:
* Defer Lazy Image Loader
* [Replace raven-js with @sentry/browser](https://gitlab.com/gitlab-org/gitlab-ce/issues/56329)
* [Improve Initialisation and Update Library for Keyboard Shortcuts](https://gitlab.com/gitlab-org/gitlab-ce/issues/56331)
# Reduce Main JS Bundle Size
* ES2015+ bundles for modern browsers & transpiled ES5 for older ones should reduce bundle size and parsing time
* Proper Tree Shaking for gitlab-ui
* Reduce through Bundle Splitting that we don't have all 3 dropdown libraries in main.js package
* Reduce size by lazy loading search box JS
* [Improve bundling of digests.json](https://gitlab.com/gitlab-org/gitlab-ce/issues/39000) :heavy\_check\_mark:
* [Reduce main.js Bundle size by removing echarts](https://gitlab.com/gitlab-org/gitlab-ce/issues/56987) :heavy\_check\_mark:
* [Reduce Bundle Size by making select2 loading optional](https://gitlab.com/gitlab-org/gitlab-ce/issues/56988) :heavy\_check\_mark:
* Reduce Bundle Size by loading markdown-it only when needed
# Reduce Main CSS Size
* Move CSS for GitLab themes in single files so we load only the theme we actually use
* Move Code Highlighting Themes in single files so we load only the code theme we actually use
epic