score:0

i am not sure if it's the best way, but in my application i am using copy-webpack-plugin for this (https://github.com/webpack-contrib/copy-webpack-plugin):

 plugins: [
    ... someotherplugins,
    new copywebpackplugin([{from: 'images/*.*'}])
]

and then from react component i call

<img height="50px" width="50px" src={'/images/image.jpeg'}/>

score:1

ok, so it seems the solution was simpler than adding loaders and plugins. turns out i could simply put my images in a folder in my public directory where thebundle is being outputted and use an absolute path to the that image i wanna use.

so worked.

my dir structure look like this:

enter image description here

hope this helps anyone else having similar issues.


Related Query

More Query from same tag