flowbite-react icon indicating copy to clipboard operation
flowbite-react copied to clipboard

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

Open ddiasfront opened this issue 1 year ago • 5 comments

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

ddiasfront avatar Jan 08 '24 01:01 ddiasfront