0

For a while I was under the impression that the Angular2 Dart codegen was the way forward with the development. Unfortunately it seems that as of late I can't use codegen anymore. Here is my pubspec.yaml which does not work and produces errors. By only removing the /transform/codegen part the error is gone.

name: frontend
version: 0.0.1
description: Regatta frontend
author:
homepage: https://regatta.atlassian.net
documentation:

environment:
  sdk: '>=1.19.0 <2.0.0'

dependencies:
  angular2: 3.0.0-alpha
  angular2_components: 0.3.1-alpha
  reflectable: 1.0.1
  sass_transformer: 0.1.2+1
  greencat: 0.0.2
  browser: 0.10.0+2
  http: 0.11.3+9
  stream_transformers: 0.3.0+3

dev_dependencies:
  test: 0.12.19
  dart_to_js_script_rewriter: 1.0.2
  dart_style: 0.2.16
  pageloader: 2.2.5
  mockito: 1.0.1
  angular_test: 1.0.0-alpha+5

transformers:
  - sass_transformer
  - angular2/transform/codegen:
      platform_directives:
        - 'package:angular2/common.dart#COMMON_DIRECTIVES'
      platform_pipes:
        - 'package:angular2/common.dart#COMMON_PIPES'
      entry_points: web/main.dart
      resolved_identifiers:
        BrowserClient: 'package:http/browser_client.dart'
        Client: 'package:http/http.dart'
  - angular2/transform/reflection_remover:
      $include:
        - test/**_test.dart
        - web/main.dart
  - reflectable:
      entry_points:
        - web/main.dart
      formatted: true
  - test/pub_serve:
      $include: test/**_test.dart
  - dart_to_js_script_rewriter

Error message

pub build
Loading source assets... 
Loading angular2/transform/codegen, dart_to_js_script_rewriter, sass_transformer, reflectable, test/pub_serve and reflectable/src/transform_import transformers... 
Loading angular2 and angular2/transform/reflection_remover transformers... (3.9s)
[Error from DirectiveMetadataLinker on frontend|lib/components/navigation_bar_component/navigation_bar_component.ng_summary.json with input frontend|lib/components/navigation_bar_component/navigation_bar_component.ng_meta.json]:
Missing identifier "materialProviders" needed by "NavigationBarComponent" from metadata map
[Error from DirectiveMetadataLinker on frontend|lib/components/event_list_component/event_list_component.ng_summary.json with input frontend|lib/components/event_list_component/event_list_component.ng_meta.json]:
Missing identifier "materialProviders" needed by "EventListComponent" from metadata map
[Error from DirectiveMetadataLinker on frontend|lib/components/event_detail_component/event_detail_component.ng_summary.json with input frontend|lib/components/event_detail_component/event_detail_component.ng_meta.json]:
Missing identifier "materialProviders" needed by "EventDetailComponent" from metadata map
[Error from TemplateCompiler on frontend|lib/app_component.ng_meta.json]:
Could not find Directive/Pipe entry for name: NavigationBarComponent
. Please be aware that Dart transformers have limited support for reusable, pre-defined lists of Directives/Pipes (aka "directive/pipe aliases"). See  for details.
Building frontend... (12.2s)
1

1 Answer 1

1

I'd recommend using the standard transformer since it includes the reflection remover phase already https://github.com/dart-lang/angular2/blob/master/lib/src/transform/transformer.dart#L37.

If you must use the alternate transformer angular2/transform/codegen then you need a version of the angular2_components using the same transformer.

I experimented by adding this to your pubspec.yaml:

dependency_override
  angular2_components:
    path: ../../angular2_components

In the path I provided, I had a local clone of the git repo where I altered the pubspec.yaml file to use:

transformers:
  - angular2/transform/codegen:
  ...

That allowed the package to build.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot, that seems to be the issue. I don't exactly know why I changed the transformer to codegen. I guess some tutorial must have suggested it and at that time it also worked. I now use the original transformer again and am happy with it. At least with this problem. The other one is in a separate bugreport...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.