flutter-packages icon indicating copy to clipboard operation
flutter-packages copied to clipboard

Investigate ways to reduce .js bundle size on web

Open zs-dima opened this issue 2 years ago • 4 comments
trafficstars

Package

google_fonts

Existing issue?

What happened?

google_fonts library JavaScript itself has the file size of 8Mb. It is only library JavaScript, so fonts are loaded additionally and have their own file sizes.

Might be nice to reduce the library JavaScript file size to something acceptable for the web.

google_fonts_base.dart.lib.js size 8Mb image

Relevant log output

No response

zs-dima avatar Mar 21 '23 07:03 zs-dima

I am interested in that topic as well to bring down the bundle size for web. Is HTTP fetching at runtime enabled by default for Flutter Web? If that were the case it would at least not be a blocking call

razfazz avatar Mar 24 '23 11:03 razfazz

Why is file size a concern for local, debug-mode development?

However, this does bring up the concern for release mode, where a minimal app has a main.dart.js with an uncompressed 4.1MB size, up from 1.7MB.

minimal app with google_fonts minimal app
image image

Is HTTP fetching at runtime enabled by default for Flutter Web? HTTP fetching is the default, and can be turned off with https://pub.dev/documentation/google_fonts/latest/google_fonts/GoogleFonts/config.html

guidezpl avatar Apr 20 '23 09:04 guidezpl