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

Bundling of @klarr-agency/circum-icons-react is not right. #20

Open
sannajammeh opened this issue May 22, 2023 · 1 comment
Open

Bundling of @klarr-agency/circum-icons-react is not right. #20

sannajammeh opened this issue May 22, 2023 · 1 comment

Comments

@sannajammeh
Copy link

sannajammeh commented May 22, 2023

A few bundle issues here result in production and development errors.

  1. You ship React in your bundle, causes mismatching versions error.
  2. There is no Barrel export so Webpack based frameworks will experience a development slowdown trying to serialize 400kb of modules.
  3. The bundle is un-treeshakeable due to it shipping all icons as an array and serializes them in runtime.
  4. Using this library results in 77kb added to bundle regardless of bundler and serializer

To resolve:

  1. Add React as a peer dependency so Rollup skips bundling it.
  2. Consider running a generate script before building to generate a React component for each SVG as a separate file.
  3. Add a barrel export file for all the generated components
  4. Run SWC or any other transpiler over the bundle to produce ESM and CJS modules.

I am happy to fix these issues and submit a PR if you'd like.

@Klarr-Agency
Copy link
Owner

Hi @sannajammeh ,
Thank you for bringing these errors to my attention and offering to assist. I am not familiar with React and packaging in general. You can submit a PR to include React as a peer dependency to address this issue. Additionally, for the other points, you can create a separate branch. I might have to do the same for the other frameworks. I decided to create an array initially to keep the publishing process more straightforward, but I am willing to consider making a component for each icon if it improves performance.

Thanks for your help!

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

No branches or pull requests

2 participants