2

When I select Tools > Generate Javascript in Dart editor, I get an error message saying that I need to select a Dart library. I want to convert the entire project into javascript. I can't figure out how to do that.

2 Answers 2

2

In the menu,

Tools > Pub build

Then the generated javascript will be created in the /build/web folder.

Source

Sign up to request clarification or add additional context in comments.

Comments

1

You need to select a dart file in a project that has a main function. Then you can use Tools > Generate Javascript to generate the Javascript. Dart automatically find all dependencies and compiles them to Javascript. If you have multiple projects that you want to compile, you need to do it for every project.

2 Comments

Hi, before asking a new question I thought I use this one as it comes up pretty high on SO search. Compiling the clickme sample of 20 lines of code gets me almost 6000 lines of code in JavaScript. That's a bit more than expected. Can I reduce that by putting it through closure compiler or will that break the code? Noticed when I use dart2js --minify mini.dart it's "only" 686 lines. Not sure if I should try and reduce that with closure compiler. Do you have experience with that?'
I have only used --minify, no additional closure compiler yet.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.