We are using Webpack and Angular template with require
syntax like below in officeJS Add-In.
@Component({
moduleId: module.id.toString(),
selector: 'list',
template: require('./list.html')
})
We are getting error Component 'List' must have a template or templateUrl
on Component declaration.
I don't have much detail about Webpack, but with templateUrl
application not working (might be because of with webpack/system.js), Application is not able to get HTML by templateUrl
at runtime.
But core problem with above require syntax is I'm not getting intellisense in template HTML w.r.t associated component by Angular Language Service.
I found one open issue on GitHub for this require syntax https://github.com/angular/angular/issues/23553
Considering solution for template syntax, Do we have any alternative solution where intellisense and webpack both can work together?
We are using Angular 4 and "webpack": "^4.41.5", but I think this issue exists for higher Angular version as well, based on above GitHub post.
Recent Observation:
I tried with new Angular Project from scratch for OfficeJS as per https://learn.microsoft.com/en-us/office/dev/add-ins/quickstarts/word-quickstart?tabs=yeomangenerator
here as well facing same issue with default webpack configuration, seems there might be some limitation.