Skip to content

Language Service: using require() to load templates displays component must have a template or templateUrl #23553

@jimmymain

Description

@jimmymain

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

I have a simple component that uses webpack to load templates.

@Component({
  selector: "app-sidebar-header",
  template: require("./app-sidebar-header.component.html")
})
export class AppSidebarHeaderComponent { }

Current behavior

the error is displayed
Component 'AppSidebarHeaderComponent' must have a template or templateUrl

Expected behavior

I do not expect to see the error message
The template actually exists, it's just being loaded by webpack. This method resolves a lot of issues with loading templates in unit tests, and is essential for my workflow.

Angular version: 5.2.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: language-serviceIssues related to Angular's VS Code language servicefeatureIssue that requests a new featurefeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorsfeature: votes requiredFeature request which is currently still in the voting phasefreq1: low

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions