Skip to content

Allow TypeScript path mapping in templateUrl #9766

Closed
@alfaproject

Description

@alfaproject

Currently, it seems impossible to use TypeScript type mapping for templateUrl and even styleUrls which is a bit odd since it seems to me that TypeScript should be resolving all paths?

Repro steps

  • Add a path map to tsconfig.json compiler options: "paths": { "@core/*": ["core/*"] }
  • Use a mapped path in a component's templateUrl property: templateUrl: '@core/forms/login-form.component.html'
  • ng serve --aot

Observed behavior

ERROR in : Couldn't resolve resource @core/forms/login-form.html' from /ng-cli/src/app/home/login-form.component.ts

Desired behavior

The TypeScript path mapping works as expected like everywhere else, and the templates are found and compiled.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions