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

image! require error #6

Closed
boyswan opened this issue Apr 16, 2015 · 5 comments · Fixed by #7
Closed

image! require error #6

boyswan opened this issue Apr 16, 2015 · 5 comments · Fixed by #7

Comments

@boyswan
Copy link

boyswan commented Apr 16, 2015

Firstly thank you for this, it's great!

The only problem I've had is requiring images via Image.xcassets. Is there currently a way to handle this?

@mjohnston
Copy link
Owner

Let me know if this works for you: https://github.com/willpiers/react-native-image-loader

@mjohnston
Copy link
Owner

There doesn't appear to be documentation there, but I imagine you would have to rewrite the require statement in your code to something like:

require('my_image.png');

And in your webpack config:

modules: {
  loaders: [
    {test: /\.png$/, loaders: ['react-native-image']}
  ]
}

The loader would transform your code to:

require('image!my_image');

@colinhicks
Copy link
Contributor

@boyswan, your issue sounds familiar. If @mjohnston's suggestion isn't what you need, would you mind giving my changes in #7 a spin?

@boyswan
Copy link
Author

boyswan commented Apr 18, 2015

@mjohnston thanks, has no compile errors however doesn't display the image. @colinhicks #7 works perfectly! Thanks

@MoOx
Copy link

MoOx commented Oct 27, 2016

@mjohnston I am currently looking for a react native like webpack loader for image since I use react-native-web but your previous link https://github.com/willpiers/react-native-image-loader is a 404 for me. Any idea where I can find this thing?

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

Successfully merging a pull request may close this issue.

4 participants