Goodmorning to all,
For some time now I'm trying to solve an issue with google maps being shown (in storelocator) in production mode.In devloper mode it is working fine, the API is correct working but when changing to Production mode the google map is not working???
Really hope someone can help me out on this issue,
Thank you very much :-)
Solved! Go to Solution.
Hi @RockMariska
I understand the issue you are facing !
I think its because of in production mode - JS merging, minifying and bundling is enable and due to that google map js might get conflict.
So can you please check in product mode - if JS bundling is enabled then kindly disabled it for the same.
As per my experience, sometimes due to enable js bundling it gets conflict ! so kindly disable it and check it
Then again check it - it might works !
Which extension you are using for store locator? And before changing mode you executed php bin/magento s:s:d -f and php bin/magento setup:di:compile command? If not please do it as in production mode it will not generate any static content deploy.
Also, could you please elaborate google map is not working? you are getting any console error or map is not displaying?
Hi @RockMariska
Can you please check browser console on google map screen ? what error is showing over there ? is there any API key related error are you able to see ?
If yes post the error or screenshot , so its help us to troubleshoot the issue !
Hi @joan_cornet
Thank you for your response, the extension is magesolution storelocator. Yes I have done all the deployments etc. I have been testing this on my staging and production environment.
so far the browser console gives me on the production mode:
(index):388 Uncaught ReferenceError: drawMap is not defined
at (index):388
at dispatch (eval at require.load (190699cb9b55412946853e172e9cc12d.min.js:173), <anonymous>:340:447)
at elemData.handle (eval at require.load (190699cb9b55412946853e172e9cc12d.min.js:173), <anonymous>:313:172)
at r.I.begin (default:620)
at default:778
although the Google API checker gives me:
Maps Platform Report
SUCCESS: Woohoo! This site is correctly using an API key when loading the Maps JavaScript API v3.
INFO: We could not find a visible Google Map within 2 seconds of loading the page. To optimize performance, only load the Maps JavaScript API if you plan on using the API.
Hi @Manthan Dave ,
Thank you for your response,
I've checked the API with API checker and tells me:
Hi @RockMariska
I understand the issue you are facing !
I think its because of in production mode - JS merging, minifying and bundling is enable and due to that google map js might get conflict.
So can you please check in product mode - if JS bundling is enabled then kindly disabled it for the same.
As per my experience, sometimes due to enable js bundling it gets conflict ! so kindly disable it and check it
Then again check it - it might works !
Awesome @Manthan Dave ,
That's been the fix! great thank you so much for your help!
I had an issue with these js minification settings before, you think it wouldn't dare to leave them disabled?
Thank you again
Hi @RockMariska
Glad to know my solution works for you, Happy to help and keep helping
In regards to JS minification - Based on my experience minfication won't make any issues , it will works easily. so if you have done JS minfication that is ok ! bundling makes issues sometimes with third-party js and that's the reason i suggest to disable it
Hope it helps !
Although i am confident that your query would have been resolved by now. But for some who come here searching this case, i am posting my experience. I am adding to the response by Manthan Dave, whose response i found very helpful. In addition to Minify, Bundling, Merging of JS, Minify HTML also causes such issues. Minify HTML is present above JS and CSS minification options in Stores -> COnfiguration -> Developer in Developer Mode.