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 shake not working correctly #58

Open
fhuonder opened this issue Jun 27, 2023 · 4 comments
Open

tree shake not working correctly #58

fhuonder opened this issue Jun 27, 2023 · 4 comments

Comments

@fhuonder
Copy link

fhuonder commented Jun 27, 2023

Hi,

I am using Flutter 3.10.4 and version 7.0.7296 of this library.
I noticed that somehow the tree shaking does not work correctly.

Maybe it has something to do with the changes in Flutter 3.10 (tree shake does now work for web as well)?

In my project I only use MdiIcons.XXX. Nothing dynamic. I use around 125 icons.
In an older version the tree shaken materialdesignicons-webfont.ttf was 18KB. Now its size is 1MB.
The Flutter build says:
Font asset "materialdesignicons-webfont.ttf" was tree-shaken, reducing it from 1279992 to 1034252 bytes (19.2% reduction).
Something is shaken off but not all of it. I looked into the ttf file with an online font viewer and there I see a lot of icons that are not used in my project.

Any idea where the problem comes from? Is there a bug?

Regards,
Florian

@ziofat
Copy link
Owner

ziofat commented Jun 28, 2023

As far as I know, flutter 3.10 does have some changes with this. I will looking into this but breaking changes maybe introduced.

@provokateurin
Copy link

I can confirm the behaviour. I also only see 19.2% reduction although I don't use a lot less icons than that.

@fhuonder
Copy link
Author

fhuonder commented Sep 4, 2023

Hi @ziofat

Any news here?

@provokateurin
Copy link

https://pub.dev/packages/flutter_material_design_icons is an easy drop-in replacement and the tree shaking works with it.

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