Can I load Vue.js from a CDN in production? Can I load Vue.js from a CDN in production? vue.js vue.js

Can I load Vue.js from a CDN in production?


Is there any reason I couldn't just link to a CDN like this in my production code?

No, there is no reason not to use a CDN in production. It's even a preferred way for serving content in production mode, especially with common packages like jQuery, because most of the people would already have loaded and therefore cached this resource.

A co-worker suggested that may be for development only, and that unpkg is simply transpiling on the fly (which doesn't sound good for performance).

This is absolutely not true - that's why it is a CDN! :) It's a matter of choice, but you have to keep in mind that most of the time you should work with specific version of the library that you are using during development. If you just add the latest version of any code, you are vulnerable to all changes pushed to that repository, and so your clients will start receiving updated code, which you haven't tested yet.

Therefore fix to a specific version that you develop with, open a beer and have a good sleep :)


These maybe help:

<!-- development version --><script src="https://unpkg.com/vue"></script><!-- production version --><script src="https://unpkg.com/vue/dist/vue.min.js"></script>

And it will keep current version of Vue.js automatically.