Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't seem to get images to work with both dev and prod modes #10

Open
rstudner opened this issue Oct 6, 2016 · 0 comments
Open

Can't seem to get images to work with both dev and prod modes #10

rstudner opened this issue Oct 6, 2016 · 0 comments

Comments

@rstudner
Copy link

rstudner commented Oct 6, 2016

So I added the url-loader etc:

    {
      test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
      loader: 'url-loader?limit=10000',
    }

So in SiteSidebar.js if I do:

import imgSrc from '../../roger93.jpg'

and then later:

          {/*<img styleName='LogoImage' src='http://i.imgur.com/79JhCaq.png' />*/}
          <img styleName='LogoImage' src={imgSrc} />

In dev mode, it will base64 encode images until 10k and just do a path for images > 10k. Awesome.

But when I do npm run build, npm run prod it fails:

SyntaxError: /Users/rstudner/projects/react-router-redux-example/roger93.jpg: Unexpected character '�' (1:0)
> 1 | ����&

I'm guessing that in prod somehow it isn't either figuring out how to point to the image (or something).

Since you hadn't yet addressed an example of "local images" (versus the SideSidebar pointing at a remote image) I was wondering if you had any insight with how to do "local images".

To note, my image was just at the root of the project, so not inside of public. (hence the ../..)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant