Thanks to all those who tried to help me! Ironically, after countless of hours of trying to figure it out, the moment I post it here, lightbulb went off and I resolved the issue myself.
I had two problems. First was how I was adding it to my webpack, and the second was how I was calling it in my index.js.
Below is the new webpack:
const path = require('path');
module.exports = {
output: {
path: path.join(__dirname, '/client/dist/js'),
filename: 'app.js'
},
module: {
loaders: [
{
test: /\.js?$/,
include: path.join(__dirname, '/client/src'),
loader: 'babel-loader',
query: {
presets: ["react", "es2015"]
}
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url-loader'
}
]
},
devtool: "source-map"
};
and this is my new index.js
import React from 'react';
import handclick from './images/hand-click.png';
class App extends React.Component {
render() {
return (
<div>
<img style={{width:300}}
src={handclick}/>
<br/>
Hello world!!
</div>
);
}
}
export default App;
Thanks all!