[Vuejs]-Vuejs include javascript library in spa

0👍

Well, If your library exist in NPM, then this is the best option, because then you have this option to import only the part of the script that you need for certain components, for example, fontawesome library, you can import only the icons that you need instead of import all of them!

but if your script is not in NPM, the best option is to run your script in beforeMount or beforeCreate of the component that the script needed to run.

the third way which is add the link reference on html is not really suggested, since it will be global and will reduce the performance.

Leave a comment