I am trying to integrate Google maps in a shopware PseudoModalUtil modal window. I then have to add the marker cluster library and add a few clusters.
The thing is, the Google maps API and the marker cluster library are JavaScript files that are normally fetched from a URL, hence the script tag.
However, I don't want to add random script tags in my twig templates, as I am sure nobody would. I guess my two left options would be:
- Either create two distinct JS files for the Google maps API JS response and marker cluster JS response respectively, and then include them in my storefront JS module.
- Or try to install them as web-pack modules and include them in my storefront module. But I think I need to add a package.json file somewhere, and them somehow use web-pack to install everything and include installed modules.
I do not know which approach, if any of these two, is good. I did not find anything in the developer documentation for shopware 6, and on the slack channel nobody seems to answer this question.
I found two links here that are somewhat useful:
One that shows how to do this for the administration side: How to add third-party dependency javascript to Shopware 6
The other is how to do this in webpack generally: How to import static url using webpack
I think that's about it.