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
Copy file name to clipboardExpand all lines: docs/en/features/es2015.md
+18-9
Original file line number
Diff line number
Diff line change
@@ -26,14 +26,7 @@ We are using ES2015's Object literal shorthand here to define the child componen
26
26
27
27
### ES2015 in Templates
28
28
29
-
Note that expressions inside `<template>`s do not get processed by the same Babel (or Buble) configuration like the `<script>` parts, because some ES2015 features cannot be compiled into render-function-friendly code. However, `vue-loader` does process the generated render function to selectively support a few convenient ES2015 features:
These features are quite convenient in dynamic class bindings, for example:
29
+
`<template>` in `*.vue` files are compiled into JavaScript render functions and then processed by a custom build of [Buble](https://buble.surge.sh/guide/) to support ES2015 features. This allows you to use features such as [Object shorthand properties](https://buble.surge.sh/guide/#object-shorthand-methods-and-properties-transforms-concisemethodproperty-) and [computed properties](https://buble.surge.sh/guide/#computed-properties-transforms-computedproperty-):
Copy file name to clipboardExpand all lines: docs/en/options.md
+16-34
Original file line number
Diff line number
Diff line change
@@ -117,54 +117,36 @@ module.exports = {
117
117
- type: `Object`
118
118
- default: `{}`
119
119
120
-
Configure options for `buble-loader` (if present). For example, to enable Object spread operator:
120
+
Configure options for `buble-loader` (if present), AND the buble compilation pass for template render functions.
121
+
122
+
The template render functions compilation supports a special transform `stripWith` (enabled by default), which removes the `with` usage in generated render functions to make them strict-mode compliant.
123
+
124
+
Example configuration:
121
125
122
126
```js
127
+
// webpack 1
123
128
vue: {
124
129
buble: {
125
-
objectAssign:'Object.assign'
126
-
}
127
-
}
128
-
```
129
-
130
-
### templateBuble
130
+
// enable object spread operator
131
+
// NOTE: you need to provide Object.assign polyfill yourself!
132
+
objectAssign:'Object.assign',
131
133
132
-
- type: `Object`
133
-
- default:
134
-
```js
135
-
{
136
-
target: { chrome:52 },
137
-
transforms: {
138
-
stripWith:true, // vue only
139
-
computedProperty:true,
140
-
conciseMethodProperty:true,
141
-
templateString:true
134
+
// turn off the `with` removal
135
+
transforms: {
136
+
stripWith:false
137
+
}
142
138
}
143
139
}
144
-
```
145
-
146
-
Configure options for a [Buble](https://buble.surge.sh/) transpile pass applied to raw render functions. The purpose of this additional pass is to:
147
-
148
-
1. add selective support to a few ES2015 features that are handy in template expressions (whitelisted in default transforms);
149
140
150
-
2. remove the `with` block inside render functions to make it strict-mode compliant and a bit more performant. This is enabled by the custom `stripWith` transform, and applied only at build time so that the base template compiler can be extremely small and lightweight.
151
-
152
-
With this option you can turn on additional [transforms](https://buble.surge.sh/guide/#supported-features) (e.g. arrow functions) or turn off `with` removal based on your specific needs. Example config with Webpack 2:
0 commit comments