themesberg / flowbite-react

Official React components built for Flowbite and Tailwind CSS
https://flowbite-react.com
MIT License
1.78k stars 396 forks source link

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

Closed ddiasfront closed 3 weeks ago

ddiasfront commented 6 months ago

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
vercel[bot] commented 6 months ago

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
codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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 ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

SutuSebastian commented 5 months ago

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

toteto commented 3 months ago

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 commented 3 months ago

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 commented 3 weeks ago

Fixed in https://github.com/themesberg/flowbite-react/pull/1264