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

Cannot find module when reqiure image path use es6 string template #1076

Closed
iamzuijiasunyou opened this issue Mar 27, 2018 · 2 comments
Closed

Comments

@iamzuijiasunyou
Copy link

image

@gnijuohz
Copy link
Contributor

It seems Parcel currently doesn't support this, see discussions in #125 and #1006.

@luke-robertson
Copy link

luke-robertson commented Apr 19, 2018

One way of doing this, which is pretty terrible

import icons from './assets/icons/**'

const icon_file_name = 'user'
const specificIcon = icons[`${icon_file_name}.png`]

<img src={specificIcon} />

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

No branches or pull requests

4 participants