I\'m trying to build my own Angular 2/ASP.NET SPA on Visual Studio. You can find all the files here.
What I tried to do is simple: after I followed the instructions to
In my case I solved the issue by removing the hyphen from component's name: product-list.component => wrong productlist.component => OK
The UniversalModule currently requires that external assets for templates and styles use require().
Try changing templateUrl: './test.component.html'
to template: require('./test.component.html')
.
And styleUrls: ['./test.component.css']
to styles: [require('./test.component.css')]
More details on the issue can be found here: Unable to load assets without using require()
For reference, here is the issue thread from Angular on Github: track runtime styleUrls. They recommend using the angular2-template-loader.
I run into this and in my case the problem was from an upgrade of angular2-templeate loader. The new version "0.6.1" caused this error to appear. I introduced the previous version "0.6.0" and everything worked ok.
This issue occurs from angular2-template-loader
with SSR
and there are
a couple of reasons why this issue appears:
angular2-template-loader
is up to date.Usually, all the issues are related with @Component.
-
in component name. (this has been fixed)Check your webpack version (in a command line window, run webpack --version
), if it's 1.XX then install the latest version of webpack 2 (2.2.X) and run it on the solution folder, and try again
My problem was I'm a webpack noob and tried to execute a tsc
command which as per Steve Sanderson:
causes VS to spew garbage
.js
files all over your source directories...
The fix is to
*.js
and *.js.map
files<TypeScriptCompileBlocked>
is true in the *.csproj