Circum-Icons
Circum-Icons copied to clipboard
Bundling of @klarr-agency/circum-icons-react is not right.
A few bundle issues here result in production and development errors.
- You ship React in your bundle, causes mismatching versions error.
- There is no Barrel export so Webpack based frameworks will experience a development slowdown trying to serialize 400kb of modules.
- The bundle is un-treeshakeable due to it shipping all icons as an array and serializes them in runtime.
- Using this library results in 77kb added to bundle regardless of bundler and serializer
To resolve:
- Add React as a peer dependency so Rollup skips bundling it.
- Consider running a generate script before building to generate a React component for each SVG as a separate file.
- Add a barrel export file for all the generated components
- 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.
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!