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
Possible Img Require() problem? #87
Comments
Hi @Axion741, are you properly using template literals (template strings) here? // regular string
'<img src={require("./img/articles/2019/1/react.png")}></img>';
// template string
`<img src="${require("./img/articles/2019/1/react.png")}">` The regular string will stringify the require statement whereas the string template will interpolate the require value. Also, like you shown in your last example, the
If I'm misunderstanding your issue, could you please reproduce it in a CodeSandbox? |
Well now I'm at even more of a loss. |
Sorry for missing your last comment @Axion741. Were you able to resolve your issue? |
Closing issue due to inactivity. Feel free to reopen if there are any new updates. |
I'm trying to narrow down why my images are breaking when parsed.
The HTML string to be parsed is this;
<img src={require("./img/articles/2019/1/react.png")}></img>
Which is then parsed into this;
<img src="{require("./img/articles/2019/1/react.png")}">
Resulting in a broken Image.
For testing I hardcoded an Image in below with this;
<img src={require("./img/articles/2019/1/react.png")}/>
And it loads just fine.
Any thoughts?
The text was updated successfully, but these errors were encountered: