christopherafbjur / sanity-plugin-icon-picker

MIT License
30 stars 27 forks source link

Tree shaking is not possible #64

Open gustavorino opened 11 months ago

gustavorino commented 11 months ago

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 commented 8 months ago

+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 commented 8 months ago

+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:sanity-plugin-icon-picker-fix@0.0.2",

guillermo-avalos commented 6 months ago

+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:sanity-plugin-icon-picker-fix@0.0.2",

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 commented 6 months ago

How do I install your fix?

@guillermo-avalos , on your package.json


- "sanity-plugin-icon-picker": "3.3.0",
+ "sanity-plugin-icon-picker": "npm:sanity-plugin-icon-picker-fix@0.0.2",