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

perf(component treeshaking): updated config and build files to treesh… #1218

Closed
wants to merge 3 commits into from

Conversation

ddiasfront
Copy link
Contributor

@ddiasfront ddiasfront commented Jan 8, 2024

Each component can now OPTIONALLY be imported individually from the components path.

EXAMPLE:

import { Badge } from "flowbite-react/components/Badge";

function App() {
  return (
    <div className="w-10/12">
      <Badge>Test</Badge>
    </div>
  );
}

Components with old pattern:


import { Badge } from "flowbite-react";

function App() {
  return (
    <div className="w-10/12">
      <Badge>Test</Badge>
    </div>
  );
}

Will still work, but will still treeshake hell as well.

PS: This pr will not fix the themes treeshaking which seems to be more complex.

#1197

Keen to hear back from the maintainers.

FINAL BUILD RESULT with "/components":
Screenshot 2024-01-07 at 22 43 02

FINAL BUILD RESULT w/out "/components":
Screenshot 2024-01-07 at 23 37 51

…ake single components

Each component now is treeshshaken individually into the final build

BREAKING CHANGE: How import components

themesberg#1197
Copy link

vercel bot commented Jan 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
flowbite-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 8, 2024 2:50am

…references on exports"

Exporting components from index to maintain legacy code usable, added optional individual exports as
/components
Copy link

codecov bot commented Jan 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7461173) 99.54% compared to head (dd3df45) 97.36%.
Report is 185 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1218      +/-   ##
==========================================
- Coverage   99.54%   97.36%   -2.18%     
==========================================
  Files         163      214      +51     
  Lines        6621     9077    +2456     
  Branches      401      530     +129     
==========================================
+ Hits         6591     8838    +2247     
- Misses         30      239     +209     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SutuSebastian
Copy link
Collaborator

Will be implemented in the next version of the monorepo -> next release

@toteto
Copy link

toteto commented Mar 17, 2024

The approach is OK, think it solves partially the reported issue of #1197.

Will be implemented in the next version of the monorepo -> next release

@SutuSebastian is this fix you are mentioning part of 7.3? What version will the fix be in? Is there a PR of the fix you mentioned?

@SutuSebastian
Copy link
Collaborator

The approach is OK, think it solves partially the reported issue of #1197.

Will be implemented in the next version of the monorepo -> next release

@SutuSebastian is this fix you are mentioning part of 7.3? What version will the fix be in? Is there a PR of the fix you mentioned?

There is a PR on it, its #1264, almost done.

@SutuSebastian
Copy link
Collaborator

Fixed in #1264

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

Successfully merging this pull request may close these issues.

3 participants