I'm using Webpack and VueJs 2. I want to use a 3rd party javascript library in my component, such as this:
<script async defer src="https://apis.google.com/js/api.js" ... ></script>
I found an article here about how to do this for npm packages, but that doesn't work for me since this library is not available as npm package.
It's not possible for me to download the file locally and use it since the library might change and stop working. Therefore it has to be loaded from the link every time the page is loaded by the browser.
I found one possible solution here but that is basically a hack(modify dom to add a script
element after document is loaded)
I believe there must be a simple good practice solution for this issue since I assume this is a common use-case.
Update: If I put the script inside head tags in my index file, it would be loaded for all the components. For performance reasons, I would want it to be loaded only for a certain component.