Even though CDNs are made to be reliable. It is a resource you have no control over. Maybe they will clean up the content after a while and remove (little used) resources. Maybe the CDN is blocked for the users. etc.
So, it depends:
how quickly can you adept your program to resolve CDN related issues
are there network accessibility constraints (think: corporate networks)
The company I work for makes so called enterprise software. So I have made it a rule to not use CDNs for anything we can host ourselves.
But for personal projects or PoCs I often do use CDNs. But once I start approaching shippable products I try to in-source the resources as much as possible.
I agree with all of this. I'll add that if you can add the npm package and include the library as part of your build with the rest of your code, your code should be cleaner. You can rely on imports instead of global variables.
All-in-all I'd call the CDN a quick and dirty version or a good solution depending on your needs, but when in doubt, make it part of your package.json.
Disclaimer: I'm always uncertain about anything in JS land these days π
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
As in most cases the answer is: It depends.
Even though CDNs are made to be reliable. It is a resource you have no control over. Maybe they will clean up the content after a while and remove (little used) resources. Maybe the CDN is blocked for the users. etc.
So, it depends:
The company I work for makes so called enterprise software. So I have made it a rule to not use CDNs for anything we can host ourselves.
But for personal projects or PoCs I often do use CDNs. But once I start approaching shippable products I try to in-source the resources as much as possible.
I agree with all of this. I'll add that if you can add the npm package and include the library as part of your build with the rest of your code, your code should be cleaner. You can rely on imports instead of global variables.
All-in-all I'd call the CDN a quick and dirty version or a good solution depending on your needs, but when in doubt, make it part of your
package.json
.Disclaimer: I'm always uncertain about anything in JS land these days π