1 The difference between run-time compiler and Run-time only

When we create vue-CLI, we will encounter the following options.

As you can see in the vue instance, run-time compiler creates template and components as arguments, while run-time only creates the render function as arguments.

Component rendering process

2.1 runtime – the compiler

In run-time compiler versions, the component rendering process is template -> ast -> render -> vdom -> DOM. Ast is the abstract syntax tree, and VDOM is the virtual DOM. In this process the template is converted to the render function via vue-template-complier.

2.1 runtime – only

Render: (h) => createElement, -> createElement; render: (h) => createElement, -> createElement

3 Use selection

  • Simply put, if template is used in future development, choose run-time Compiler. If the. Vue file is used in future development, runtime-only can be selected.
  • Run-time only is about 30% lighter and has higher performance than the run-time Compiler version. So use runtime-only versions whenever possible.