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 map require error #191

Closed
Hazantip opened this issue Jul 11, 2016 · 5 comments
Closed

image map require error #191

Hazantip opened this issue Jul 11, 2016 · 5 comments

Comments

@Hazantip
Copy link

Hazantip commented Jul 11, 2016

Node version:
6.2.2
npm version:
3.9.0
Operating system:
win10
Command line used:
npm run start
Steps to reproduce:
map list with images. probplem with image src={require(image)}

const images = props.postcardImages.map((image, i) => { return ( <li className="postcards-list-item" onClick={() => {props.setPostcardActiveImage(image);}} key={image + i}> <Link to="/postcard-edit"> <img src={require(image)} alt=""/> </Link> </li> ); });
image - string with image path. if i put just string(not variable) it works fine, but i need to map it. when i try to do this staff i get the error:
Uncaught Error: Cannot find module '../images/postcard.jpg'.(anonymous function) @ Uncaught TypeError: Cannot read property '__reactInternalInstance$f26nyhc5w3kdfida23zph9f6r' of null

@coryhouse
Copy link
Owner

Your syntax looks right to me, so I suspect the path you're referencing is invalid. That said, since this isn't an issue with React Slingshot working out of the box, I'm going to close and suggest using StackOverflow instead.

@Hazantip
Copy link
Author

Hazantip commented Jul 11, 2016

Path is correct. cause if i put it directly everything ok. just prolem if put variable to require =(

I am sure, that is a React Slingshot problem.

@coryhouse
Copy link
Owner

@Hazantip
Copy link
Author

Thaks, but unfortunately, it doesn't solve the problem..

@Hazantip
Copy link
Author

Thats a really big problem, cause i can't create a production build without generated images.

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

2 participants