I\'m new on VueJS ans Webpack. I\'ve created a project with VueJS CLI and trying to work with it. I need to insert an CDN to my code.
When working with standard HTML
Unfortunately, no, you can't add a tag to a specific component via template.
In your case you have some options:
Propertly install the dependency using npm
Steps:
For your case, you can check in datatables official page they do have a NPM package. I could be used like:
npm install --save datatables.net-dt
And in your .vue file:
tag to index.htmlLocate and a dd the tag to your index.html
tag is clearly (and declaratively) added to the HTML source. The script will only be loaded once. to the end of the index.html file, preferably right before .
tag programaticallyThe other alternative is to create the script tag programatically at the component, when the component is lodaded.
Steps/Code: