I will suposse that you folder project tree is similar that and your server side was made with Nodejs, cause it was not clear in your question:
.projectFolder
|--.client
| |--.components
| |--bundle.js
| |--index.js
| |routes.js
|
|--.node modules
|--.server
|--.public
| |--.assets
| |--.images
| | |--hi.png
| |
| |--.css
|
|--index.html
|--index.js
Therefore I advise you to use a Static folder and call this using:
app.use(express.static(path.join(__dirname, 'public')));.
So, everything inside public will be tracked and you can just callback these image with:
<img src={'/assets/images/hi.png'} width="150px" className="lateral-margin" />
Not having the necessity of use require, or anything like that. Sure, of this way your code keep more organized to other and for you too.
However, in your case require is not working because probably you neither setting your webpack nor npm installed babel-loader. Read more about loaders, download and set it with:
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}
]
}
<img src='hi.png' />try it.