-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
TypeError: placeholder.indexOf is not a function #104
Comments
I don't think we support |
Thank you @bluebill1049, however for some reason works perfect for me (also in Outside this importing stuff, the end result of the |
Ok, I solved this way <SimpleImg
placeholder{require(`./path/to/img`).default}
/> Don't know where is the root of the problem, probably bundler side. Will continue to investigate however. |
interesting... I suspect it returns a string now. |
yes, also before returns a |
Describe the bug
Declaring a
placeholder
usingrequire
gives the error shown in the title.To Reproduce
Steps to reproduce the behavior:
require('./images/cover.svg')
throws an error.src
propExpected behavior
This used to word until I updated to
create-react-app@4
(which implies to removenode_modules
folder and reinstall dependencies, so maybe is related to another change). But seems that the error reproduce well in CodesandboxScreenshots
![Screenshot 2020-10-26 at 12 20 03](https://user-images.githubusercontent.com/784056/97166532-b1711700-1785-11eb-93b3-05478c6e83ea.png)
Desktop (please complete the following information):
Additional context
I know that work ok just
import
ing the two files, but in my case I am using several images that render dynamically so i used to pass the values likerequire('./images/image_' + n + '.svg')
The text was updated successfully, but these errors were encountered: