Cdn | Local | NPM | SoloLearn: Learn to code for FREE!


Cdn | Local | NPM

which is normally best way to load js libraries is it using cdnjs or Local or installing libraries using npm or anyother way!!

1/25/2020 4:50:10 AM


4 Answers

New Answer


getting the library in local space is surely, much more reliable because its hosted along with your server files. no need to fear of "what if the cdn server down". the downside is its increase the bandwidth using CDN is direct opposite, lower bandwidth but its hosted in other location just make sure its reliable cdn server. another plus is you dont need to bother to get the library into the serverfiles. npm is another thing, its easy to access like cdn and its hosted in your own server. the bit of downside is sometimes you need an "extra code" to make it work, either by manually extracting the files or by using browserify or webpack

+5 Check it this Q/A ,may be it's helpful for you


thanks @taste which would u suggest


stick with npm if you're using browserify or webpack or other things that capable to. if the size are pretty small its still safe to put it in as local file. but me personally i would choose cdn, because how simple it is to use