When we use vUE, we can refer to two different versions of vue, respectively, vue full version (vue.js) and Vue (vue.runtime.js) incomplete version, so what are the differences between them? Today we will analyze the differences between these two versions.

1. File name

2. File size

Full version: Contains both compiler and runtime versions.

Compiler: Code used to compile template strings into JavaScript rendering functions.

The non-full version does not include a compiler and is about 30% smaller than the full version.

3, view,

The full version

Views are written in HTML or in the Template option and, thanks to the compiler, the full runtime: code used to create Vue instances, render and manipulate the virtual DOM, etc. Basically everything else is stripped out of the compiler.

The full version

Full version runtime: When using vue-loader or Vueify, templates inside the *. Vue file are precompiled to JavaScript at build time. You don’t really need a compiler in the final package, so just use the runtime version.

New Vue({render (h) {render (h) {render (h) {return h('div', this.hi)}}) // Need the compiler new Vue({template:'<div>{{ hi }}</div>'
})
Copy the code

4, configuration,

Imported from Webpack, the full version requires alias configuration, while the incomplete version is the default;

Imported from @vue/cli, the complete version requires additional configuration, and the incomplete version is the default configuration.

conclusion

Since there are so many differences between the two, which version do we usually use?

The incomplete version, of course, for the following reasons:

1. Ensure user experience. JS files downloaded by users are smaller in size, but only h functions are supported

2. To ensure development experience, developers can directly write HTML tags in vue files instead of h functions

3. Let loader do the work, VUe-loader will vue file HTML into H function, so I do not need to write too much trouble H function can do the same thing as the full version, but also save the file size, improve user experience.

Finally, thank you for checking, I am Chen Youwei, if you like my share, please like and forward more support.