WilliamDASILVA / nuxt-google-maps-module

Inject Google Maps script
MIT License
22 stars 8 forks source link

Google Maps script is loaded twice #10

Open gorankrgovic opened 5 years ago

gorankrgovic commented 5 years ago

For some reason on my Nuxt spa app, the module loads the maps script twice giving the following error in console:

You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.

I'm not using any other method to fetch the Google maps API apart from this module and the configuration is:

 ['nuxt-google-maps-module', {
      key: 'my-google-maps-api-key'
    }]
KaniRobinson commented 5 years ago

Are there any updates on this?

felixdenoix commented 5 years ago

@gorankrgovic @KaniRobinson Could this answer be of any help by any chance ? https://github.com/nuxt/nuxt.js/issues/138#issuecomment-272867436

AGrinx commented 5 years ago

Hi guys, I have the same issue with You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors. I use mode=spa so it is not related to server-side

conseromarketing commented 5 years ago

Having the same issue. Did anyone solve this problem?

felixdenoix commented 5 years ago

@propsoft I did a fork and changed a few things ! Appears to be working... I do not guarantee anything and you probably should fork it and review the code before using it ! (you can then install it from your own repo using npm install <git-host>:<git-user>/<repo-name>)

shainegordon commented 5 years ago

@felixdenoix was the only change really in /lib/module.js, the removal of the async on the exported function?

https://github.com/felixdenoix/nuxt-gmaps-custom/compare/827279f7762e90d0d302d1094edc458646746514...be85f701ad046cede48a27c09ac98414f857d79e

felixdenoix commented 5 years ago

@shainegordon as well as adding build targets for ie 11 and changing the way the maps object is injected in the window around here if I'm not mistaken !

harlet commented 4 years ago

Mine is working as expected, maybe because I use the maps option on the nuxt root config. ¯\(ツ)

modules: [
    // https://github.com/WilliamDASILVA/nuxt-google-maps-module
    'nuxt-google-maps-module'
],
maps: {
    key: 'CODE'
}