webpack-contrib / file-loader

File Loader
MIT License
1.86k stars 257 forks source link

Outputting wrong file name for image #73

Closed JellyKid closed 8 years ago

JellyKid commented 8 years ago

https://github.com/JellyKid/TwitchTV_FCC

You can find my webpack config there. I'm importing an image in app/components/Channel.jsx. File-loader creates an empty image file and URL string passed to the URL variable. Then it creates the correct file with a totally different hash. I can't seem to get it to give me the correct url or figure out why it's creating an empty image with the correct name.

For example, if I build my project I get two png files. One 1KB PNG b28d947a261b18ffe4e9740a151b60b5.png and a second 4KB PNG aadf7e0813a755cc519342de5ce91041.png, but file-loader returns the string to the first blank image. File loader should really only be creating one image, so where the second one is coming from, I'm baffled.

JellyKid commented 8 years ago

Not a problem with file-loader.... It has something to do with webpack preloaders. If importing with "!file!../images/twitch.png" it loads only the one PNG file. Going to open a case on webpack since I'm not actually using any preloaders.

tobycox commented 8 years ago

I ran in to something similar and it turned out it was because I was using the babel loader, which was already loading images. I didn't need to have my own file-loader for loading images.