I'm new to dart, and am using Dart Editor on Windows.
I noticed that my compiled javascript is huge, so I kept removing more and more code to see what was causing it, but I don't think I'm getting anywhere. Here's my program right now:
import 'dart:html';
void main() {
var video = querySelector("#vid");
}
That's literally it. I've stripped out everything but one instruction.
And this is the produced javascript (it won't fit inline):
https://gist.github.com/DSteve595/504887a19a05614bcc94
What am I doing wrong? This program's practically empty!
The file you linked to in the gist is 48k. If you ran dart2js with the --minify
option, you could bring the size down quite a bit.
Your code may be trivial, but dart2js has to load a significant number of libraries by default, and it has to load the dart:html
library that you import as well. For perspective, how big do you think your file would be if you wrote your program in JavaScript and imported all of jQuery?
You can read more about dart2js at https://www.dartlang.org/docs/dart-up-and-running/contents/ch04-tools-dart2js.html.