From 1880755587bfed1c337da8cfc626999e52569041 Mon Sep 17 00:00:00 2001 From: Vadim Yakhin Date: Thu, 10 Jun 2021 11:59:52 -0300 Subject: [PATCH] Add a comment explaining why we're not loading async components through index file --- x-pack/plugins/security/public/ui_api/components.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/x-pack/plugins/security/public/ui_api/components.tsx b/x-pack/plugins/security/public/ui_api/components.tsx index eeee7946663b7..a488bc359b538 100644 --- a/x-pack/plugins/security/public/ui_api/components.tsx +++ b/x-pack/plugins/security/public/ui_api/components.tsx @@ -10,6 +10,14 @@ import React from 'react'; import type { CoreStart } from 'src/core/public'; +/** + * We're importing specific files here instead of passing them + * through the index file. It helps to keep the bundle size low. + * + * Importing async components through the index file increases the bundle size. + * It happens because the bundle starts to also include all the sync dependencies + * available through the index file. + */ import { getChangePasswordComponent } from '../account_management/change_password/change_password_async'; import { getPersonalInfoComponent } from '../account_management/personal_info/personal_info_async'; import { LazyWrapper } from './lazy_wrapper';