2 Techniques To Avoid when Using Vue Libraries

Well, It goes without saying that Vue JS is a nice Frontend Framework that has large ecosystem and most developers are falling in Love with it.

However, as you climb the ladder of 'development' success in Vue. You will discover there are some things you ought not to do.

And here they are:

  1. Do not add a library directly to the window. Like so

    window.moment = require('moment')
    

    And yes, it might work in the browser. However, it will suck like nobodies business when try doing that in server-side rendering.

  2. Importing in Every file. Like so.

import charts from 'chartjs'

Now imagine you have 20 or more files which imports this. This approach is time consuming because at any time you want to change or remove it altogether, Then you will ultimately have to remove or change from all those files.

##CONCLUSION.

I hope you have learned something. Stay tuned to get to know how to do this correctly in my upcoming article that is still cooking. See you then. Stay safe. Thanks.