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

Importing Individual Icons Causes Entire Folder to be Imported #3

Open
MisterHims opened this issue Sep 21, 2024 · 0 comments
Open

Comments

@MisterHims
Copy link

Hello,

I am encountering an issue with the solar-icon-set package when attempting to import individual icons. According to the expected usage, we should be able to import icons individually like this:

import { SidebarMinimalistic } from 'solar-icon-set/dist/icons/networkitprogramming/SidebarMinimalistic';

However, this import statement results in the entire networkitprogramming folder being included in the bundle, which significantly increases the bundle size and negatively impacts performance.

Problem:

Even when I try to import a specific icon as shown above, the entire folder is imported instead of just the single icon. This makes it impossible to use the package efficiently in projects where optimization and minimal bundle size are critical.

Expected Behavior:

The expected behavior is to import only the specified icon, without including all the icons in the same folder.

Actual Behavior:

The actual behavior is that the import statement includes all the icons from the networkitprogramming folder, not just the SidebarMinimalistic icon. This results in unnecessary code being bundled and sent to the client.

Proposed Solution:

Update the exports field in the package.json to allow for precise, individual icon imports without including the entire folder. For example:

"exports": { "./files/*": "./dist/icons/Files/*", "./networkitprogramming/*": "./dist/icons/NetworkItProgramming/*", "./videoaudiosound/*": "./dist/icons/VideoAudioSound/*", ... }

This change would greatly improve the usability and efficiency of the solar-icon-set package, allowing developers to import only the components they need. Thank you for considering this request!

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

1 participant