Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Vue3 compilerOptions Property

Vue3 compilerOptions Property


Vue3 Options API Vue3 Options API

In Vue 3,compilerOptions is an object used to configure Vue's template compiler.

The template compiler is responsible for converting Vue's template syntax (such as v-bind, v-if , etc.) into JavaScript code. Through compilerOptions, developers can control the compiler's behavior, such as how to handle whitespace, whether to preserve comments, whether to enable specific optimizations, and so on.


Common compilerOptions Configurations

1. whitespace

Purpose: Controls how to handle whitespace in templates.

Optional values:

Example

const

app

=

createApp

(

App

,

{

  compilerOptions

:

{

    whitespace

:

'condense'

 

}

}

)

;

2. comments