nuxt-google-maps-module icon indicating copy to clipboard operation
nuxt-google-maps-module copied to clipboard

Google Maps script is loaded twice

Open gorankrgovic opened this issue 7 years ago • 8 comments
trafficstars

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'
    }]

gorankrgovic avatar Oct 18 '18 10:10 gorankrgovic

Are there any updates on this?

KaniRobinson avatar Jan 08 '19 16:01 KaniRobinson

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

felixdenoix avatar Apr 08 '19 13:04 felixdenoix

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

AGrinx avatar May 03 '19 07:05 AGrinx

Having the same issue. Did anyone solve this problem?

conseromarketing avatar Aug 21 '19 20:08 conseromarketing

@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>)

felixdenoix avatar Aug 22 '19 09:08 felixdenoix

@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

shainegordon avatar Sep 10 '19 13:09 shainegordon

@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 !

felixdenoix avatar Sep 16 '19 13:09 felixdenoix

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'
}

harlet avatar Mar 29 '20 07:03 harlet