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

Tree shaking is not possible #64

Open
gustavorino opened this issue Dec 23, 2023 · 4 comments
Open

Tree shaking is not possible #64

gustavorino opened this issue Dec 23, 2023 · 4 comments

Comments

@gustavorino
Copy link

Tree-shaking is not possible due to the fact that react-icons libraries are hardcoded on the plugin and activated by a string.

It would be a breaking change, but I think the way icons are enabled should be refactored:

Current implementation ( bundle will include all the other libraries even if not used) :

options: {
        providers: ["fa"]
    }

Tree-shaking friendly ( bundle will only contain fa )

import * as fa from 'react-icons/fa';

// ...

options: {
        providers: {fa:fa}
    }
@travismfrank
Copy link

+1 on this, this is preventing me from deploying an embedded studio to an edge runtime (Cloudflare Workers) as the icon sets each take up multiple MBs.

@gustavorino
Copy link
Author

+1 on this, this is preventing me from deploying an embedded studio to an edge runtime (Cloudflare Workers) as the icon sets each take up multiple MBs.

@travismfrank here is my fork to use while this is not fixed :

"sanity-plugin-icon-picker": "npm:[email protected]",

@guillermo-avalos
Copy link

+1 on this, this is preventing me from deploying an embedded studio to an edge runtime (Cloudflare Workers) as the icon sets each take up multiple MBs.

@travismfrank here is my fork to use while this is not fixed :

"sanity-plugin-icon-picker": "npm:[email protected]",

I’m facing a similar issue. The plugin makes my Studio bundle size almost 5 MB. I’m only using a handful of FA icons. I hate react-icons with a passion. How do I install your fix?

@gustavorino
Copy link
Author

How do I install your fix?

@guillermo-avalos , on your package.json

- "sanity-plugin-icon-picker": "3.3.0",
+ "sanity-plugin-icon-picker": "npm:[email protected]",

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

3 participants