Dartlang: Dev Transformers in pubspec.yaml

Issue

I want to know if there is a possibility of defining “development only” transformers in a pubspec.yaml file.

My Problem is:

I have some angular2 components in separate repositories. I have written some examples for them in their respective example folder. To run these examples, i have an entry-point html file in the examples folder, which bootstraps the angular2 application.

For this to work, I have to include this entry point file in the transformer for angular2 like so:

transformers:
- angular2:
  entry_points:
  - example/breakpoint_consumer/breakpoint_consumer.html

This is all fine. However, when i want to use that component later in another project, the example folder will not be pulled in. This is a good thing, however, pub tells me, that it can’t find the entry point inside of the example folder.

I think it’s possible to simply ignore the error, because it’s not doing anything. But it would be nice to know anyway, if this can be solved 🙂

Solution

dev_transformers are not directly supported

https://github.com/dart-lang/pub/issues/1260#issuecomment-163065340

As of ef743d5, pub will fully ignore dependencies’ transformers that use $include to ensure that they only run on non-public files, even if those transformers come from dev dependencies. This allows you to effectively have “dev transformers” by restricting transformers to test/ or web/.

Answered By – Günter Zöchbauer

Answer Checked By – Gilberto Lyons (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.