r-park / todo-react-redux

Todo app with Create-React-App • React-Redux • Firebase • OAuth
https://todo-react-redux.firebaseapp.com
MIT License
1.02k stars 272 forks source link

Trying to get images to load #54

Closed morgs32 closed 8 years ago

morgs32 commented 8 years ago

Doing my best, but it's not good enough. If you cold throw an image into your example, that would be great. I've added

{
    test: /\.(jpe?g|png|gif|svg)$/i,
    loaders: [
      'file?hash=sha512&digest=hex&name=[hash].[ext]',
      'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
    ]
  }

To the webpack config, and still doing this in a component: const HeroImg = require('./dish.jpg');

Throws an error:

Unexpected character '�' (1:0)
> 1 | ����
[nodemon] app crashed - waiting for file changes before starting...

Thanks!

jessemezini commented 8 years ago

Try to npm install --save-dev file-loader url-loader

morgs32 commented 8 years ago

The problem is you can't require on the server. It's apparently a well known problem with react isomorphic that I'm just learning about now.