I've been looking around for this for houres, and can't find a solution that works.
I'm trying to add a local uri to and img element, but it it can't resolve it.
import React from 'react'
import image from '../assets/udemy2.PNG'
const WorkingSpinner = () => (
<div>
<img height="50px" width="50px" src={image}/>
</div>
)
export default WorkingSpinner
I'm trying to use the file-loader
with webpack
and my config looks like this:
module: {
rules: [{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
}, {
loader: 'file-loader',
test: /\.(png|jpe?g|gif)$/i,
options: {
name: '[name].[ext]',
outputPath: "images"
}
}, {
loader: 'url-loader?limit=8192',
test: /\.(png|jpe?g|gif)$/i,
}]
I simply don't know why it does not work, according to the docs and different turtorials I've watched I'm doing things according to the solution. Still, all I get is an empty image when I'm trying to render my component.