X Tutup
Skip to content

templateUrl behaves differently when using the Dart transformer #2945

@andresaraujo

Description

@andresaraujo

I don't know if it a bug or not, but the behaviour of the templateUrl is different when using the transformer. e.g:

This works okay without the transformer:

// app.dart
@Component( selector: "my-app" )
@View(
    templateUrl: "packages/my_app/app.html",
)
class AppComponent {}

But adding the transformer result in this error:

[Warning from DirectiveProcessor on my_app|lib/app.dart]:
Invalid URL to reach to another package: packages/my_app/app.html. Path reaching to other packages must first reach up all the way to the packages directory. For example, try changing the URL to: ../../packages/my_app/app.html
[Error from DirectiveProcessor]:
Uri packages/ng2_dart_quickstart/app.html not supported from my_app|lib/app.dart, could not build AssetId

To make it work with the transformer I had to change the templateUrl to either "app.html" or "../../packages/my_app/app.html". But then then comes the issue that it will not work if you remove the transformer.

Project layout:

├── lib
│   ├── app.dart
│   └── app.html
├── pubspec.yaml
└── web
    ├── index.html
    └── main.dart

Tested on alpha 30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup