-
Notifications
You must be signed in to change notification settings - Fork 8
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
$google undefined when using nuxt run build && npm run start
#3
Comments
@zsalzbank Could you be more specific ?. Do you have some logs? |
The error I get in my browser console is:
The code where I am trying to use mounted () {
this.autocomplete = new this.$google.maps.places.Autocomplete(this.$refs.search, {
types: [
'(regions)'
],
componentRestrictions: {
country: 'US'
}
})
} If I replace |
@zsalzbank Just tested and indeed, I get the error sometimes when the Google script is not loaded yet. mounted () {
if (this.$google) {
this.autocomplete = new this.$google....
}
} |
I could, but I still need that code to be called regardless (I'm using |
It's happening the same for |
@zsalzbank @sergioalvz Alright, fixed the issue of $google being undefined in the creation hook for the v1.5.5. It injects an empty object, then remplace the property in the vue prototype with the getter referencing $google.
Could not reproduce the build / generate issue but it may fix it. |
Still having the same problem unfortunately. |
Hi there. 👍 Same problem for me, after npm run build & npm run start,
My module is configured like this:
|
I had same problem.
|
Same here after generating, seems like the this.$google is not defined yet when it runs. |
Same issue here, thanks to @polidog, that fixed worked for me. |
I'm getting the same issue even with a regular |
doesn't seem to work in production only on dev environment |
Had the same problem, @polidog workaround fixed it. |
When I run in development (
npm run dev
), everything works. When I build and serve the result, I getTypeError: Cannot read property 'maps' of undefined
.The text was updated successfully, but these errors were encountered: