No ResourceLoader for Angular component templateUrl in ASP.NET Core (.NET Framework) #675

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

Originally created by @JaimeStill on 6/9/2017

Built an ASP.NET Core (.NET Framework) Empty web project, and installed the following NuGet Packages:

  • Microsoft.AspNetCore (1.1.2)
  • Microsoft.AspNetCore.Mvc (1.1.3)
  • Microsoft.AspNetCore.SpaServices (1.1.1)
  • Microsoft.AspNetCore.StaticFiles (1.1.2)
  • Microsoft.Extensions.Logging.Debug (1.1.2)

Mirrored the aspnetcore-spa Angular template with the following modifications:

  • Renamed ClientApp (and all references) to src
  • Installed semantic-ui-css instead of bootstrap

This same setup works fine in an ASP.NET Core web app that targets .NET Core, but when targeting .NET Framework, I get the following exception:

Exception: Call to Node module failed with error: Error: No ResourceLoader implementation has been provided. Can't read the url "app.component.html" at Object.get (..src\dist\vendor.js:53089:15)

The only way to get rid of this error is to change component template URLs as follows:

templateUrl: './app.component.html' // throws error

to

template: require('./app.component.html') // works just fine

The full project can be found in this GitHub Repo

*Originally created by @JaimeStill on 6/9/2017* Built an ASP.NET Core (.NET Framework) Empty web project, and installed the following NuGet Packages: * `Microsoft.AspNetCore (1.1.2)` * `Microsoft.AspNetCore.Mvc (1.1.3)` * `Microsoft.AspNetCore.SpaServices (1.1.1)` * `Microsoft.AspNetCore.StaticFiles (1.1.2)` * `Microsoft.Extensions.Logging.Debug (1.1.2)` Mirrored the `aspnetcore-spa` Angular template with the following modifications: * Renamed `ClientApp` (and all references) to `src` * Installed `semantic-ui-css` instead of `bootstrap` This same setup works fine in an ASP.NET Core web app that targets .NET Core, but when targeting .NET Framework, I get the following exception: ``` Exception: Call to Node module failed with error: Error: No ResourceLoader implementation has been provided. Can't read the url "app.component.html" at Object.get (..src\dist\vendor.js:53089:15) ``` The only way to get rid of this error is to change component template URLs as follows: ``` ts templateUrl: './app.component.html' // throws error ``` to ``` ts template: require('./app.component.html') // works just fine ``` The full project can be found in this [GitHub Repo](https://github.com/JaimeStill/Angular4Framework/tree/master/Angular4Framework)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#675
No description provided.