Turn off dart2js during pub build

Issue

I am writing a custom transformer for pub build. I would like to turn off compilation of dart files to js during debugging of the transformer to save time. Is it possible?

Currently, my simplified pubspec.yaml is

name: my_proj
dependencies:
    polymer: any
transformers:
    - my_proj

Solution

There is no option for pub build only for pub serve --no-dart2js.

You could temporary modify the file

dart/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart in your dart install directory and set useDart2JS to ‘false’.

see also https://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/sdk/lib/_internal/pub/lib/src/barback/build_environment.dart#56

I haven’t tried it myself but I think this should work.

Or exclude the web directory for the dart2js transformer in pubspec.yaml

transformers:
- $dart2js:
    $exclude: web

Answered By – Günter Zöchbauer

Answer Checked By – Katrina (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *