I am struggling to show local images in my react app. I am calling the image inside my render method using the require() function, like so:
<img src={require('../../assets/svg/ic_planning.svg')} />
Not even importing images work, like:
import icon from '../../assets/svg/ic_planning.svg'
<img src={icon} />
And on my webpack.config.js I have the following rules for image loading:
{
test: /\.(jpg|png|svg)$/,
loader: 'url-loader',
options: { limit: 10000 }
},
{
test: /\.(jpg|png|svg)$/,
loader: 'file-loader',
options: { } // name: '[path][name].[hash].[ext]'
},
Both url-loader and file-loader dependencies have ben installed. I had the name option inside file-loader options but I commented it to test, with no success. Not even jpg images are showing.
Webpack is building images with no error outputs and no error shows up in the dev console on chrome, but I still get that not loaded image icon on my page. I know there is a similar question from 2 years ago and it seems to me that I did everything I'm supposed to do to load local images.
Here's the webpack log if it helps:
I'm not sure what other informations might help to figure out what's going on so let me know what I need to post here. Thank you all in advance for any help provided.