Skip to content
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

fix: updates to optimize tree shaking #467

Merged
merged 21 commits into from
Mar 20, 2024
Merged

fix: updates to optimize tree shaking #467

merged 21 commits into from
Mar 20, 2024

Conversation

joshhowenstine
Copy link
Contributor

@joshhowenstine joshhowenstine commented Feb 16, 2024

Description

This PR eliminates all re-exports from the codebase and replaces them with direct file references. The primary goal of this change is to improve our project's compatibility with tree shaking. By directly referring to files, we can ensure that only the code actually used in the project is included in the final bundle, which will lead to smaller bundle sizes and better performance in production environments.

References

NO-JIRA

Testing

Testing if tree shaking is working properly takes a few steps. You will need to utilize an existing or new project to see the results.

  1. Ensure Correct Webpack Configuration: Check that your Webpack configuration is optimized for tree shaking. This includes:
  • Utilizing ES6 module syntax (import and export) throughout your project.
  • Setting mode to 'production' in your Webpack configuration to enable optimizations like tree shaking.
  • Confirming that the sideEffects property in your package.json is properly configured to false or accurately lists fles/modules that do have side effects, aiding Webpack in excluding unused modules.
  1. Build the Project: Execute the Webpack build process using npm run build or your project's equivalent script to generate the production bundle.

  2. Review Output: After the build, review the output to ensure there are no errors or warnings related to the tree shaking process or the direct file references. This step is crucial to verify that the modifications have not introduced any build issues. The final bundle should only include Lightning UI components that have been used in your project. All others should no longer be present in the final code.

Automation

All automation tests should pass as expected. This should have no effect on exported components or functions.

Checklist

  • all commented code has been removed
  • any new console issues have been resolved
  • code linter and formatter has been run
  • test coverage meets repo requirements
  • PR name matches the expected semantic-commit syntax

@joshhowenstine joshhowenstine added the WIP In progress but could use an initial review label Feb 16, 2024
@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

1 similar comment
@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

@joshhowenstine joshhowenstine removed the WIP In progress but could use an initial review label Mar 1, 2024
@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

6 similar comments
@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Passed.

@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Passed.

@ImCoolNowRight
Copy link
Contributor

I've built this, brought it into inner source's develop branch, built that, and then imported into AirUI. When I built the app, I'm still seeing components that certainly aren't being used showing up in the final bundle. We can pair on this when you're back in the office, but I think either I missed something in testing, or something in the PR needs adjusting.

@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Passed.

Copy link
Contributor

@ImCoolNowRight ImCoolNowRight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super minor points of clarification, but functionally, I think everything's good to go with this!

Copy link
Contributor

@ImCoolNowRight ImCoolNowRight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good!

@svc-lightning-ui-components
Copy link
Collaborator

Test Execution Failed.

@joshhowenstine joshhowenstine merged commit f11dc92 into develop Mar 20, 2024
9 checks passed
@joshhowenstine joshhowenstine deleted the tree-shaking branch March 20, 2024 15:41
svc-lightning-ui-components pushed a commit that referenced this pull request Mar 21, 2024
# [@lightningjs/ui-components-v2.20.5](https://github.com/rdkcentral/Lightning-UI-Components/compare/@lightningjs/ui-components-v2.20.4...@lightningjs/ui-components-v2.20.5) (2024-03-21)

### Bug Fixes

* allow CardContent to pass through style to Tile component ([#487](#487)) ([ef67bc8](ef67bc8))
* allow CardContentVerticalSmall to control marquee onFocus ([#485](#485)) ([6a0208a](6a0208a))
* **KeyboardSearch:** allow custom key styles inside a preset Keyboard ([#484](#484)) ([68387a0](68387a0))
* updates to optimize tree shaking ([#467](#467)) ([f11dc92](f11dc92))
@svc-lightning-ui-components
Copy link
Collaborator

🎉 This PR is included in version @lightningjs/ui-components-v2.20.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants