mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-24 05:50:21 -05:00
@@ -76,7 +76,7 @@ See [@babel/preset-env docs](https://new.babeljs.io/docs/en/next/babel-preset-en
|
||||
|
||||
### polyfills
|
||||
|
||||
- Default: `['es6.promise', 'es6.array.iterator']`
|
||||
- Default: `['es6.array.iterator', 'es6.promise', 'es7.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**.
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
const path = require('path')
|
||||
|
||||
const defaultPolyfills = [
|
||||
'es6.promise',
|
||||
// promise polyfill alone doesn't work in IE,
|
||||
// needs this as well. see: #1642
|
||||
'es6.array.iterator'
|
||||
'es6.array.iterator',
|
||||
// this is required for webpack code splitting, vuex etc.
|
||||
'es6.promise',
|
||||
// #2012 es6.promise replaces native Promise in FF and causes missing finally
|
||||
'es7.promise.finally'
|
||||
]
|
||||
|
||||
function getPolyfills (targets, includes, { ignoreBrowserslistConfig, configPath }) {
|
||||
|
||||
@@ -13,7 +13,8 @@ module.exports = ({ types }) => {
|
||||
|
||||
const { polyfills } = state.opts
|
||||
const { createImport } = require('@babel/preset-env/lib/utils')
|
||||
polyfills.forEach(p => {
|
||||
// imports are injected in reverse order
|
||||
polyfills.slice().reverse().forEach(p => {
|
||||
createImport(path, p)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user