-
Notifications
You must be signed in to change notification settings - Fork 0
addd example 2 #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
addd example 2 #66
Conversation
| import * as AllIcons from 'components/Icon'; | ||
| import * as AllUtils from 'utils'; | ||
| import * as AllComponents from 'components'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import * as AllIcons from 'components/Icon'; | |
| import * as AllUtils from 'utils'; | |
| import * as AllComponents from 'components'; | |
| import { IconFacebookCircle } from 'components/Icon/IconFacebookCircle'; | |
| import { IconTwitter } from 'components/Icon/IconTwitter'; | |
| import { IconGitHub } from 'components/Icon/IconGitHub'; |
The component imports complete modules using wildcard imports (import * as) for Icons, Utils, and Components. This pattern imports the entire module content into the bundle even when only a few items are used, significantly increasing the initial JavaScript payload. This directly impacts Core Web Vitals metrics like LCP and TTI by forcing users to download, parse, and execute unnecessary code.
Review by Conductor
Is this review helpful? React 👍 or 👎 to let us know!
| import HeavyDataVisualization from 'components/HeavyDataVisualization'; | ||
| import ComplexFormBuilder from 'components/ComplexFormBuilder'; | ||
| import AnalyticsLibrary from 'heavy-analytics-package'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import HeavyDataVisualization from 'components/HeavyDataVisualization'; | |
| import ComplexFormBuilder from 'components/ComplexFormBuilder'; | |
| import AnalyticsLibrary from 'heavy-analytics-package'; | |
| const HeavyDataVisualization = React.lazy(() => import('components/HeavyDataVisualization')); | |
| const ComplexFormBuilder = React.lazy(() => import('components/ComplexFormBuilder')); | |
| const AnalyticsLibrary = React.lazy(() => import('heavy-analytics-package')); |
The component imports heavy, unused components that will be included in the bundle. While they're not rendered, importing HeavyDataVisualization and ComplexFormBuilder still pulls their code into the main bundle unnecessarily, impacting page load performance and Core Web Vitals metrics like LCP and FCP.
Review by Conductor
Is this review helpful? React 👍 or 👎 to let us know!
| // This unused code will still be included in the bundle | ||
| const unusedAnalytics = new AnalyticsLibrary(); | ||
| const unusedComponents = [HeavyDataVisualization, ComplexFormBuilder]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // This unused code will still be included in the bundle | |
| const unusedAnalytics = new AnalyticsLibrary(); | |
| const unusedComponents = [HeavyDataVisualization, ComplexFormBuilder]; | |
| // Removed unused code that was impacting performance |
The component initializes a heavy analytics library instance during render. This synchronous operation runs on every component render, blocking the main thread and impacting Core Web Vitals metrics, particularly FCP and LCP. Even though the variable is unused, the initialization still occurs and consumes resources.
Review by Conductor
Is this review helpful? React 👍 or 👎 to let us know!
No description provided.