Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Adding images to server side rendered react app?

$
0
0

Hey All,

I am using this template: https://blogs.msdn.microsoft.com/webdev/2017/02/14/building-single-page-applications-on-asp-net-core-with-javascriptservices/ It is a nice example but I am unsure how to add images(png/svg) to the code so it can be rendered on the client and server. Any ideas?

I followed this example: https://stackoverflow.com/questions/42351606/react-server-side-rendering-vs-webpack/42351831 However, these methods did not seem to work with this code:

import * as React from 'react';
import { RouteComponentProps } from 'react-router-dom';
//import closedEye from './assets/closed_eye.svg';

import closedEye from './assets/analysis';


export default class Home extends React.Component<RouteComponentProps<{}>, {}> {
public render() {
return (<div><h1>Home</h1><img src={closedEye} className="" alt="logo" /></div>
)
}
}

With this error
Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Module parse failed: /Users/alexandermorton/Documents/Zenith/netCoreReact/ClientApp/splash-headshop/src/assets/analysis.png Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type.


tldr: I just want to know at what point in client and server side rendering I should add the svg/png files for this template?




Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>