module.exports = {
module: {
rules: [
{
test: /\.(png|jpe?g|gif)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[path][name].[ext]',
},
},
],
},
],
},
};
import React from 'react';
import image from './image.png';
const Example = () => (
<img src={image} />
);
import React from 'react';
const Example = () => (
<img src={require('./image.png')} />
);