Using Any Javascript Library With Vue.js

How To Use Any Javascript Library With Vue.js

To avoid having trouble while building your project and using libraries like axios, lodash and more, you can use the tips listed in the article Use Any Javascript Library With Vue.js by Anthony Gore. In there you will find ways to insure proper functionality and not run into problems like how to allow server rendering in your current setup.

The author begins with what he considers bad ways to include libraries in Vue, How not to include a library in a Vue.js project::

Global variable, the naive way to add a library to your project is to make it a global variable by attaching it to the window object. Importing in every file, second-rate method is to import the library into every file.

Then you can read about better ways to use external libraries into your project and further down the advice to build a library you’re planning to use across many Vue projects, into your own plugin.

Why not make it a plugin?

This article was written and submitted by Anthony Gore, originally posted on vuejsdevelopers.