[QUESTION] Cannot resolve symbol 'require' #1374

Closed
opened 2025-08-09 17:19:54 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @rbasniak on 9/19/2016

Hi,

I'm a developer with pure desktop background and I'm starting to learn web development now with ASP.NET Core and Angular 2, so please forgive me if this is a stupid question =)

I downloaded this new updated version for Angular 2 final and I'm getting an error on all component files telling me that it 'Cannot resolve symbol require' on the template: require('./name.component.html').

image

Other projects I came across use typings and to resolve such errors I just drag the index.d.ts from the typings folder to my AppModule and unresolved names errors go away.

But this new version does not use typings. Based on this I would like to ask 3 questions:

  1. Is there any way to remove the error on the require symbol? Application is running and working, it's just that's this is annoying.

  2. Why is the require required? Why I can't just use templateUrl instead with the filename?

  3. On all other tutorials I port to Asp.Net Core if I didn't reference the index.d.ts from the typings folder I get a lot of errors of unresolved symbols, like Promisse, Map, etc. But this does not happens with your Angular 2 template. Where are the typings definitions coming from?

By the way, great job with this project!!! Also this is the first and only setup I could replicate on a blank project using Angular and Webpack... Really thanks!

*Originally created by @rbasniak on 9/19/2016* Hi, I'm a developer with pure desktop background and I'm starting to learn web development now with ASP.NET Core and Angular 2, so please forgive me if this is a stupid question =) I downloaded this new updated version for Angular 2 final and I'm getting an error on all component files telling me that it 'Cannot resolve symbol require' on the template: require('./name.component.html'). ![image](https://cloud.githubusercontent.com/assets/10734059/18647090/c8bb0cc4-7e8a-11e6-9c75-b37a8009b362.png) Other projects I came across use typings and to resolve such errors I just drag the index.d.ts from the typings folder to my AppModule and unresolved names errors go away. But this new version does not use typings. Based on this I would like to ask 3 questions: 1) Is there any way to remove the error on the require symbol? Application is running and working, it's just that's this is annoying. 2) Why is the require required? Why I can't just use templateUrl instead with the filename? 3) On all other tutorials I port to Asp.Net Core if I didn't reference the index.d.ts from the typings folder I get a lot of errors of unresolved symbols, like Promisse, Map, etc. But this does not happens with your Angular 2 template. Where are the typings definitions coming from? By the way, great job with this project!!! Also this is the first and only setup I could replicate on a blank project using Angular and Webpack... Really thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1374
No description provided.