user1889543
user1889543

Reputation: 111

Package dart lib into single javascript file to make lib available in websites

I wrote my first library in dart. Now I want to make use of it in a website. My idea was to compile all necessary dart code of my lib and its dependencies into one javascript file that has a useful "global" API. As I understand this I would also write this API in dart and compile it altogether to javascript but I fail to see how this is done. The https://www.dartlang.org/tools/dart2js/ wasn't particular helpful to me.

To give a simplified example: The library is a generic parser controlled by a grammar. A parse-tree is build from some input file and a grammar. Think of it like:

ParseTree parse(File input, File grammar);

So in the resulting javascript I want to have this available in some form so one could write e.g.

var tree = MyParserLib.parse("path/to/input.file", "my.gramamar.file");

Upvotes: 1

Views: 115

Answers (1)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657416

Usually you build your entire app at once. Building distinct parts or libraries to JS and using the output in another app is not (yet?) well supported.

Upvotes: 1

Related Questions