Can I load Vue.js from CDN into production?

I chose Vue.js for the new project, because it seems to run initially in the browser, unlike something like React, which needs to be compiled / passed through Node. Is there a reason why I couldn't just reference a CDN like this in my production code?

<script src="https://unpkg.com/vue@2.2.1"></script>

The employee suggested that it could only be for development, and that unpkg just translates "on the fly" (which is not very good for performance). But also, it works fine. I could also reference a more reliable CDN like this one , but I just want to make sure that I don’t break some good practices without using a Node build system (like webpack).

+4
source share
2 answers

Is there a reason why I couldn't just reference a CDN like this in my production code?

No, there is no reason not to use CDN in production. This is even the preferred way to serve content in production mode, especially with common packages like jQuery, since most people have already downloaded and therefore cached this resource.

The employee suggested that it could only be for development, and that unpkg just translates "on the fly" (which is not very good for performance).

- CDN!:) , , , . , , , , .

, , :)

+2

, :

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

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

Vue.js.

+1

Source: https://habr.com/ru/post/1670939/


All Articles