aspnetcore-angular-universal
aspnetcore-angular-universal copied to clipboard
How to set image paths correctly
I'm trying to set image src paths and css background image paths as follows:
<img src="images/1.png" />
or
.some-css-class{
background-color:url('images/1.png');
}
but I'm getting error
NodeInvocationException: Prerendering failed because of error: Error: Cannot find module './images/1.png' at webpackMissingModule (webpack-internal:///./ClientApp/app/layout/layout.component.html:1:1035) at eval (webpack-internal:///./ClientApp/app/layout/layout.component.html:1:1124) at Object../ClientApp/app/layout/layout.component.html
my image file is at wwwroot/images/1.png
Adding a slash before images will do the trick. So, the path should be as follows:
<img src="/images/1.png" />