Vue3 Api App Config Compileroptions
# Vue3 app.config.compilerOptions Property
* * Vue3 Global API](#)
`app.config.compilerOptions` is an important configuration option that allows developers to have fine-grained control over the compilation behavior of Vue applications.
`app.config.compilerOptions` is an object used to configure compiler behavior in Vue 3. It belongs to the configuration object (`config`) of the Vue application instance (`app`), specifically designed to control template compilation behavior. By setting these options, developers can adjust the Vue compiler's behavior to meet specific requirements.
* * *
## Common Configuration Options
Here are some commonly used configuration options in `app.config.compilerOptions`:
### 1. `isCustomElement`
* **Purpose**: Used to specify which elements should be treated as custom elements (rather than Vue components).
* **Applicable Scenarios**: When you use third-party custom elements (such as Web Components) in templates, you need to mark them as custom elements to prevent the Vue compiler from treating them as unknown Vue components.
* **Example**: ## Example
app.config.compilerOptions.isCustomElement=(tag)=> tag.startsWith('my-'); The above code will treat all tags starting with `my-` as custom elements.
### 2. `whitespace`
* **Purpose**: Controls how whitespace characters in templates are handled.
* **Optional Values**:
* `'preserve'`: Preserve all whitespace characters.
* `'condense'`: Compress whitespace characters to a single space.
* `'collapse'`: Remove all redundant whitespace characters.
* **Example**: ## Example
app.config.compilerOptions.whitespace='condense'; The above code will compress whitespace characters in templates to a single space.
##```
YouTip