mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-01 03:49:04 -06:00
docs: update polyfill names according to core-js 3 (#5282)
This commit is contained in:
@@ -18,7 +18,7 @@ If one of your dependencies need polyfills, you have a few options:
|
||||
|
||||
1. **If the dependency is written in an ES version that your target environments do not support:** Add that dependency to the [`transpileDependencies`](../config/#transpiledependencies) option in `vue.config.js`. This would enable both syntax transforms and usage-based polyfill detection for that dependency.
|
||||
|
||||
2. **If the dependency ships ES5 code and explicitly lists the polyfills needed:** you can pre-include the needed polyfills using the [polyfills](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app#polyfills) option for `@vue/babel-preset-app`. **Note that `es6.promise` is included by default because it's very common for libs to depend on Promises.**
|
||||
2. **If the dependency ships ES5 code and explicitly lists the polyfills needed:** you can pre-include the needed polyfills using the [polyfills](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app#polyfills) option for `@vue/babel-preset-app`. **Note that `es.promise` is included by default because it's very common for libs to depend on Promises.**
|
||||
|
||||
``` js
|
||||
// babel.config.js
|
||||
@@ -26,8 +26,8 @@ If one of your dependencies need polyfills, you have a few options:
|
||||
presets: [
|
||||
['@vue/app', {
|
||||
polyfills: [
|
||||
'es6.promise',
|
||||
'es6.symbol'
|
||||
'es.promise',
|
||||
'es.symbol'
|
||||
]
|
||||
}]
|
||||
]
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
1. **Если зависимость написана в версии ES, которую не поддерживают целевые окружения:** Добавьте эту зависимость в опцию [`transpileDependencies`](../config/#transpiledependencies) в файле `vue.config.js`. Это позволит использовать как синтаксические преобразования, так и определение полифилов для используемых возможностей для этой зависимости.
|
||||
|
||||
2. **Если зависимость предоставляет ES5 код и явно перечисляет необходимые полифилы:** вы можете предварительно включить необходимые полифилы с помощью опции [polyfills](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app#polyfills) для `@vue/babel-preset-app`. **Обратите внимание, что `es6.promise` добавлен по умолчанию, так как он часто необходим для библиотек, основанных на Promise.**
|
||||
2. **Если зависимость предоставляет ES5 код и явно перечисляет необходимые полифилы:** вы можете предварительно включить необходимые полифилы с помощью опции [polyfills](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app#polyfills) для `@vue/babel-preset-app`. **Обратите внимание, что `es.promise` добавлен по умолчанию, так как он часто необходим для библиотек, основанных на Promise.**
|
||||
|
||||
```js
|
||||
// babel.config.js
|
||||
@@ -26,8 +26,8 @@
|
||||
presets: [
|
||||
['@vue/app', {
|
||||
polyfills: [
|
||||
'es6.promise',
|
||||
'es6.symbol'
|
||||
'es.promise',
|
||||
'es.symbol'
|
||||
]
|
||||
}]
|
||||
]
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
1. **如果该依赖基于一个目标环境不支持的 ES 版本撰写:** 将其添加到 `vue.config.js` 中的 [`transpileDependencies`](../config/#transpiledependencies) 选项。这会为该依赖同时开启语法转换和根据使用情况检测 polyfill。
|
||||
|
||||
2. **如果该依赖交付了 ES5 代码并显式地列出了需要的 polyfill:** 你可以使用 `@vue/babel-preset-app` 的 [polyfills](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app#polyfills) 选项预包含所需要的 polyfill。**注意 `es6.promise` 将被默认包含,因为现在的库依赖 Promise 是非常普遍的。**
|
||||
2. **如果该依赖交付了 ES5 代码并显式地列出了需要的 polyfill:** 你可以使用 `@vue/babel-preset-app` 的 [polyfills](https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/babel-preset-app#polyfills) 选项预包含所需要的 polyfill。**注意 `es.promise` 将被默认包含,因为现在的库依赖 Promise 是非常普遍的。**
|
||||
|
||||
``` js
|
||||
// babel.config.js
|
||||
@@ -26,8 +26,8 @@
|
||||
presets: [
|
||||
['@vue/app', {
|
||||
polyfills: [
|
||||
'es6.promise',
|
||||
'es6.symbol'
|
||||
'es.promise',
|
||||
'es.symbol'
|
||||
]
|
||||
}]
|
||||
]
|
||||
|
||||
@@ -78,7 +78,7 @@ See [@babel/preset-env docs](https://new.babeljs.io/docs/en/next/babel-preset-en
|
||||
|
||||
### polyfills
|
||||
|
||||
- Default: `['es6.array.iterator', 'es6.promise', 'es6.object.assign', 'es7.promise.finally']`
|
||||
- Default: `['es.array.iterator', 'es.promise', 'es.object.assign', 'es.promise.finally']`
|
||||
|
||||
A list of [core-js](https://github.com/zloirock/core-js) polyfills to pre-include when using `useBuiltIns: 'usage'`. **These polyfills are automatically excluded if they are not needed for your target environments**.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user