1

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");

1 Answer 1

1

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.

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

2 Comments

Say this API I talk about is my entire app. How would I do that than?
If this is an entire app, you execute pub build inside your apps directory and deploy the content of your_package/build/web (assuming your entry page was in your_package/web)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.