Skip to content

Importing Individual Icons Causes Entire Folder to be Imported #3

Description

@MisterHims

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions