2

I am trying to build but I have this situation

  1. Files in bin are server files and don't need to be compiled to js.
  2. Server files us async/await while client files don't. The server is run with the --enable-async VM option.
  3. Client files should be treeshaked/minified JS.
  4. Client files should ALSO be treeshaked/minified (if possible) to Dart.

Currently I include this in my pubspec.yaml

- $dart2js:
    $exclude: bin

because I get an error for using async on the server. If I include the async_await transformer I get even more errors (in fact I had to role back to using then on the client).

The real question is how to get efficient server and client dart files, and get efficient client js files out of the build process.

Cristian Garcia
  • 9,630
  • 6
  • 54
  • 75
  • What do you mean by 4? I guess what you want is dart2dart but this is not supported for the client (less supported than for the server I guess) – Günter Zöchbauer Feb 24 '15 at 17:27
  • Do you still need the transformer for async/await (client). I never saw/found proper information related to this topic. – Günter Zöchbauer Feb 24 '15 at 17:29
  • @GünterZöchbauer I am using Angular which contains A LOT of files and I sometimes test the server with Dartium, I'd like treeshaked files. Also, it would be nice if the server files where optimized by dart2dart. – Cristian Garcia Feb 24 '15 at 17:34

1 Answers1

0

You can use snapshots for server side code. This packs everything into one file and speeds up app startup.

See https://www.dartlang.org/articles/snapshots/ for more details.

I don't have an answer for the other points.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567