3

I have a complex project and I have multiple entry point. I was manually running dart2js, but I'm trying to use aync_await library. The library require the the transformer async_await. The problem is that dart2js doesn't automatically run the transformer. Is there a way to specify dart2js to run a transformer or to manually run the transformer?

I tried pub build, but it so broken, I can't get anywhere. For example, I can't ask it to just compile a dart file. It compile the whole project into a build directory. This works for the web directory, but I have a directory for my server which need to be compiled to js too and a test directory.

EDIT:

To inline my answer to Günter Zöchbauer.

I have the following structure:

root
 |-- packages
 |    |-- async_await (github.com/dart-lang/async_await)
 |    \-- ...
 |-- node_modules
 |-- build (auto generated by pub build)
 |    \-- web
 |         \-- ...
 |-- server
 |    |-- main.dart
 |    \-- main.js
 |-- test
 |    |-- main_unittest.dart
 |    \-- main_unittest.js
 |-- web
 |    |-- index.html
 |    \-- index.dart
 |-- package.json  (this is required to be in the root because of heroku)
 |-- Procfile  (this is required to be in the root because of heroku)
 \-- pubspec.yaml

Constraints:

1) I'm using heroku, because of that, i'm force to have "node_modules", "Procfile" and "package,json" in the root.

2) Because of pub, I'm force to have web directory and only one "pubspec.yaml" in the projet. Having multiple one, make the editor choke/hang.

3) I'm compiling to nodejs

So my problem is that my test suite and my server can't be compiled using pub build. Also, I hate having a build directory. When I'm running Dartium and I'm making change, I have to run pub build just to have it copy my change from the directory root\web to root\build\web or temporally make my server point to root/web.

I was running dart2js manually, but with async_await, I have to find an another way of doing so I can run async_await transformer. So as of now, I can't run the server, neither my testbench with async_await.

darkzangel
  • 939
  • 9
  • 17
  • Can you elaborate a bit more why you need to build another directory. Maybe your project structure can be changed so you can use `pub build` instead of `dart2js`. – Günter Zöchbauer Jan 15 '15 at 18:58
  • Inlined my answer :) My main problem is that I'm compiling my server and unittest code to js which is not recommended by Dart guideline and I'm probably the only doing this... – darkzangel Jan 15 '15 at 19:59
  • The added info is helpful to understand your requirements but I have no idea how to solve it. – Günter Zöchbauer Jan 15 '15 at 20:03

0 Answers0