4 ms·
Try importing `flutter/animation` — footprint goes WAY off the deep end. `animation.ddc.js` is 4.4MB alone (unminified), never mind the rest of the runtime AND
by zackbrown 7y ago
Try importing `flutter/animation` — footprint goes WAY off the deep end. `animation.ddc.js` is 4.4MB alone (unminified), never mind the rest of the runtime AND userland application code.
You can see this in the flutter_web/examples/gallery example. [`webdev build` failed for me in examples/gallery, so I'd love to see what a successfully minified version of that example looks like — I'm currently deeply skeptical.]
Compared to React/Vue/Angular and friends, this appears to be a monstrous outlier.
- miyoyo 7y agoDDC is not at all a representation of the final size of the code, as it doesn't run any kind of tree shaking, minification or optimization, and the animation library has a lot of things that you will definitely not import.
- tracker1 7y agoAnd here I am freaking about an uncompressed js payload of 300k for an entire app... 4+MB just feels crazy.
- mraleph 7y agoDDC stands for Dart Development Compiler. It is a fast modular compiler that you use for quick edit&refresh development in the browser. It does not do any global optimizations, unlike dart2js - which is what you use for deployment. If you write something like: import 'package:flutter_web/animations.dart'; void main() => print('Hello, World!'); DDC would faithfully compile animations.dart as whole and ship that to your browser. dart2js would include 0 bytes of code from animations.dart into the output. > `webdev build` failed for me in examples/gallery Maybe file a bug? Here is what I get for Gallery: ╭─~/s/f/f/e/gallery ⟨master ⟩ ⟨9s449ms⟩ ╰─» flutter packages pub global run webdev build ... Compiled 18,344,245 characters Dart to 1,914,077 characters JavaScript in 27.9 seconds If I gzip the output I get around 500k. Gallery uses a lot of Flutter so this is in some sense upper boundary for framework overhead. Also it is still early days - I can clearly see this pushed down.