You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Specifies a method to recognize custom elements defined outside of Vue (e.g., using the Web Components APIs). If component matches this condition, it won't need local or global registration and Vue won't throw a warning about an `Unknown custom element`.
94
-
95
-
> Note that all native HTML and SVG tags don't need to be matched in this function - Vue parser performs this check automatically
96
-
97
-
::: tip Important
98
-
This config option is only respected when using the runtime compiler. If you are using the runtime-only build, `isCustomElement` must be passed to `@vue/compiler-dom` in the build setup instead - for example, via the [`compilerOptions` option in vue-loader](https://vue-loader.vuejs.org/options.html#compileroptions).
99
-
:::
100
-
101
80
## optionMergeStrategies
102
81
103
82
-**Type:**`{ [key: string]: Function }`
@@ -139,3 +118,93 @@ The merge strategy receives the value of that option defined on the parent and c
139
118
-**Usage**:
140
119
141
120
Set this to `true` to enable component init, compile, render and patch performance tracing in the browser devtool performance/timeline panel. Only works in development mode and in browsers that support the [performance.mark](https://developer.mozilla.org/en-US/docs/Web/API/Performance/mark) API.
121
+
122
+
## compilerOptions <Badgetext="3.1+" />
123
+
124
+
-**Type:**`Object`
125
+
126
+
Configure runtime compiler options. Values set on this object will be passed to the in-browser template compiler and affects every component in the configured app. Note you can also override these options on a per-component basis using the [`compilerOptions` option](/api/options-misc.html#compileroptions).
127
+
128
+
::: tip Important
129
+
This config option is only respected when using the full build (i.e. the standalone `vue.js` that can compile templates in the browser). If you are using the runtime-only build with a build setup, compiler options must be passed to `@vue/compiler-dom` via build tool configurations instead.
130
+
131
+
- For `vue-loader`: [pass via the `compilerOptions` loader option](https://vue-loader.vuejs.org/options.html#compileroptions). Also see [how to configure it in `vue-cli`](https://cli.vuejs.org/guide/webpack.html#modifying-options-of-a-loader).
132
+
133
+
- For `vite`: [pass via `@vitejs/plugin-vue` options](https://github.com/vitejs/vite/tree/main/packages/plugin-vue#example-for-passing-options-to-vuecompiler-dom).
134
+
:::
135
+
136
+
### compilerOptions.isCustomElement
137
+
138
+
-**Type:**`(tag: string) => boolean`
139
+
140
+
-**Default:**`undefined`
141
+
142
+
-**Usage:**
143
+
144
+
```js
145
+
// any element starting with 'ion-' will be recognized as a custom one
Specifies a method to recognize custom elements defined outside of Vue (e.g., using the Web Components APIs). If component matches this condition, it won't need local or global registration and Vue won't throw a warning about an `Unknown custom element`.
150
+
151
+
> Note that all native HTML and SVG tags don't need to be matched in this function - Vue parser performs this check automatically.
152
+
153
+
### compilerOptions.whitespace
154
+
155
+
-**Type:**`'condense' | 'preserve'`
156
+
157
+
-**Default:**`'condense'`
158
+
159
+
-**Usage:**
160
+
161
+
```js
162
+
app.config.compilerOptions.whitespace='preserve'
163
+
```
164
+
165
+
By default, Vue removes/condenses whitespaces between template elements to produce more efficient compiled output:
166
+
167
+
1. Leading / ending whitespaces inside an element are condensed into a single space
168
+
2. Whitespaces between elements that contains newlines are removed
169
+
3. Consecutive whitepsaces in text nodes are condensed into a single space
170
+
171
+
Setting the value to `'preserve'` will disalbe (2) and (3).
Sets the delimiters used for text interpolation within the template.
189
+
190
+
Typically this is used to avoid conflicting with server-side frameworks that also use mustache syntax.
191
+
192
+
### compilerOptions.comments
193
+
194
+
-**Type:**`boolean`
195
+
196
+
-**Default:**`false`
197
+
198
+
-**Usage:**
199
+
200
+
```js
201
+
app.config.compilerOptions.comments=true
202
+
```
203
+
204
+
By default, Vue will remove HTML comments inside templates in production. Setting this option to `true` will force Vue to preserve comments even in production. Comments are always preserved during development.
205
+
206
+
This options is typically used when Vue is used with other libraries that rely on HTML comments.
Copy file name to clipboardExpand all lines: src/api/options-misc.md
+28-23Lines changed: 28 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -10,29 +10,6 @@
10
10
11
11
Another benefit of specifying a `name` option is debugging. Named components result in more helpful warning messages. Also, when inspecting an app in the [vue-devtools](https://github.com/vuejs/vue-devtools), unnamed components will show up as `<AnonymousComponent>`, which isn't very informative. By providing the `name` option, you will get a much more informative component tree.
0 commit comments