I am using Webpack for my React application.
I installed "File-loader" and "Url-loader" in my webpack configuration.
However, I am not sure how to associate images with my components. I keep 'src' for the image in the Data.js file, from where I transfer the data for the image to the reaction component.
My webpack.config.js:
... const PATHS = { app : path.join( __dirname, "app" ), build : path.join( __dirname, "build" ) }; const common = { entry : { app : PATHS.app }, output : { path : PATHS.build, filename : "bundle.js" }, module : { preLoaders : [ ... loaders : [ { test : /\.css$/, loaders : [ "style", "css" ], include : PATHS.app }, { test : /\.jsx?$/, loader : "babel", query : { cacheDirectory : true, presets : [ "react", "es2015" ] }, include : PATHS.app }, { test : /\.(jpg|png)$/, loader : "file-loader?name=[name].[ext]", include : PATHS.app } ...
Im my comment submission component, Im just using require to extract the image:
const PreviewTemImgParent = ({ data }) => { let img = require( data.get( "src" )); return( <div className = "card previewImgParent"> <img src = { img } ...
In the Data.js file there are absolute paths (the main application folder) for each image (maybe I'm wrong):
export const previewTemImgData = Map({ body : List.of( Map({ // using immutable.js src : "app/css/asset/template/png/body/GatheredAtEmpireLine.png", alt : "image", className : "flipParent", ...
The global catalog image, for which it costs:

I wonder where I make mistakes and how to resolve this?
EDIT: After reading, I assume that webpack needs a link for the relative position of the image, so I changed webpack.config.js as follows:
... output : { path : PATHS.build, publicPath : "/", filename : "bundle.js" } ...
However, this does not solve the problem. Leadership will be highly appreciated.