coryhouse / react-slingshot

React + Redux starter kit / boilerplate with Babel, hot reloading, testing, linting and a working example app built in
MIT License
9.74k stars 2.94k forks source link

Images are not digested #508

Closed ziadloo closed 6 years ago

ziadloo commented 6 years ago

Node version: v9.2.0 npm version: 5.5.1 Operating system: Ubuntu 16.04 Command line used: npm start -s / npm run build Steps to reproduce: Please read the description below

Hi,

I have a problem with images. I've created an "images" folder in "src" and added a rather big image file called "cat.jpg". And then in "HomePage.js" I added a simple <img> tag:

<img src="../images/cat.jpg" />

This led to the image being shown in dev mode (npm start -s). But when I build the production version (npm run build), the mentioned image is not shown. After a little digging, it seems to me that even the dev mode is not doing it right since the <img> tag's source reads exactly the same when I inspect it in the browser. If I'm not mistaken, it should have been digested in a way, should it have? I mean I can see the file-loader module mentioned in both "webpack.config.dev.js" and "webpack.config.prod.js" but the tag still points to the plain cat.jpg file on the hard disk!

Is this a bug or I'm doing something wrong?

In any case, it would be nice to include some image in the example project within the repo.

kwelch commented 6 years ago

Have you reviewed our docs on "How do I handle images?" found here

ziadloo commented 6 years ago

No, I hadn't. Thanks for the help.

kwelch commented 6 years ago

Please close this, unless you are still having issues with images. Thanks!