Daniel V.
Daniel V.

Reputation: 1198

How to use Dart's dev_compiler for simple libs?

I am experimenting with Dart's dev_compiler. I think I am missing a couple of steps how to get it working in a browser. Currently all the resources I found regarding it are: Usage

What I'd like to do is:

  1. Create a simple single class library package in Dart
  2. Compile it to ES6
  3. Use that compiled library in Canary from JS

Problems:

For now I did not get as far as to use the transcompiled library from a browser. Any tips how to do that would be appreciated.

Update:

I wrote a little post about my experiences with dev_compiler: dev_compiler experiment

Upvotes: 1

Views: 245

Answers (1)

Vijay Menon
Vijay Menon

Reputation: 31

This easiest way to play around with this is to use the "server" mode:

dartdevc -o outputdir --server foo.dart

That should generate a foo.html in the output directory that shows you what gets linked in.

For now, this will bring in all the Dart libraries - regardless of what your class actually uses. You may find that you only need a small subset to run your code.

Upvotes: 1

Related Questions