react-places-autocomplete: Powered By Google not being imported - Require Cannot find module
Hello, I get this error since lastest release 5.4.0, please help !
Uncaught Error: Cannot find module 'react-places-autocomplete/images/powered_by_google_default.png' from 'react-places-autocomplete/dist/PlacesAutocomplete.js'
Line 372 of /node_modules/react-places-autocomplete/dist/PlacesAutocomplete.js is generating the error.
this.props.googleLogo && _react2.default.createElement( 'div', { id: 'PlacesAutocomplete__google-logo', style: this.inlineStyleFor('googleLogoContainer'), className: this.classNameFor('googleLogoContainer') }, _react2.default.createElement('img', { src: require('./images/powered_by_google_' + this.props.googleLogoType + '.png'), style: this.inlineStyleFor('googleLogoImage'), className: this.classNameFor('googleLogoImage') }) )
When using hard coded path of copy of the image from my assets/images folder works perfectly. E.g. src: “http://localhost:4000/images/powered_by_google_default.png”
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 6
- Comments: 23 (7 by maintainers)
Expanding on @Floriferous 's solution, this is a quick workaround that I am using until something more permanent is implemented into the package.
You lose some semantics this way (by not having an inline image) but seems like a decent work around in the short time that could come in handy for some.
Would it make sense to remove Google Image from the library and add an optional
footerprop so that user of the library can provide their custom footer element for the dropdown? Feedback would be appreciated!@kenny-hibino forgot to mention, I am using brunch on phoenixframework. Could that be where my issue is coming from ?
brunch-config.js
Only thing that works for me is locking the version to 5.3.1
"react-places-autocomplete": "5.3.1",The answer is to add
url-loaderin your project package.json.I just added the package and it work fine.
I think it’s better to specify it in this project
package.jsonif possible because in my case I do not use url-loader