babel / babel-preset-env

PSA: this repo has been moved into babel/babel -->

Home Page:https://github.com/babel/babel/tree/master/packages/babel-preset-env

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IE 9 Array (find&findIndex) not work

Faithree opened this issue · comments

Somebody tell me how to do it? In addition to using polyfill

  "presets": [
    ["env", {
      "modules": false,
      "include":["es6.array.find","es6.array.find-index"],
      "targets": {
        "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
      }
    }],
    "stage-2"
  ],
  "plugins": ["transform-runtime"],
  "env": {
    "test": {
      "presets": ["env", "stage-2"],
      "plugins": ["istanbul"]
    }
  }
}

@Faithree You need to import 'babel-polyfill'; in the top of your project

@evan-scott-zocdoc I know it's ok to add babel-polyfill ,but 'babel-env' Contains 'find'&'findIndex' ,you can look https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js

  "typed arrays / %TypedArray%.prototype.findIndex",
  "typed arrays / %TypedArray%.prototype.fill",

I don't understand,inexplicable!

@Faithree have you tried using the useBuiltIns option? It rewrites babel-polyfill with the individual polyfills needed by your targets.

With this config:

{
  "debug": true,
  "targets": {
    "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
  },
  "useBuiltIns": "entry",
  "modules": false
}

Here's the following output (note the two polyfills you're looking for are included):

babel-preset-env: `DEBUG` option

Using targets:
{
  "android": "4.4.3",
  "chrome": "49",
  "edge": "14",
  "firefox": "54",
  "ie": "10",
  "ios": "10",
  "safari": "10"
}

Using modules transform: false

Using plugins:
  check-es2015-constants { "android":"4.4.3", "ie":"10" }
  transform-es2015-arrow-functions { "android":"4.4.3", "ie":"10" }
  transform-es2015-block-scoped-functions { "android":"4.4.3", "ie":"10" }
  transform-es2015-block-scoping { "android":"4.4.3", "ie":"10" }
  transform-es2015-classes { "android":"4.4.3", "ie":"10" }
  transform-es2015-computed-properties { "android":"4.4.3", "ie":"10" }
  transform-es2015-destructuring { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  transform-es2015-duplicate-keys { "android":"4.4.3", "ie":"10" }
  transform-es2015-for-of { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  transform-es2015-function-name { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  transform-es2015-literals { "android":"4.4.3", "ie":"10" }
  transform-es2015-object-super { "android":"4.4.3", "ie":"10" }
  transform-es2015-parameters { "android":"4.4.3", "ie":"10" }
  transform-es2015-shorthand-properties { "android":"4.4.3", "ie":"10" }
  transform-es2015-spread { "android":"4.4.3", "ie":"10" }
  transform-es2015-sticky-regex { "android":"4.4.3", "ie":"10" }
  transform-es2015-template-literals { "android":"4.4.3", "ie":"10" }
  transform-es2015-typeof-symbol { "android":"4.4.3", "ie":"10" }
  transform-es2015-unicode-regex { "android":"4.4.3", "chrome":"49", "ie":"10" }
  transform-new-target { "android":"4.4.3", "ie":"10" }
  transform-regenerator { "android":"4.4.3", "chrome":"49", "ie":"10" }
  transform-exponentiation-operator { "android":"4.4.3", "chrome":"49", "ie":"10", "ios":"10", "safari":"10" }
  transform-async-to-generator { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10", "ios":"10", "safari":"10" }
  syntax-trailing-function-commas { "android":"4.4.3", "chrome":"49", "ie":"10" }

Using polyfills with `entry` option:

[src/in.js] Replaced `babel-polyfill` with the following polyfills:
  es6.typed.array-buffer { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.typed.int8-array { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.typed.uint8-array { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.typed.uint8-clamped-array { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.typed.int16-array { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.typed.uint16-array { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.typed.int32-array { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.typed.uint32-array { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.typed.float32-array { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.typed.float64-array { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.map { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.set { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.weak-map { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.weak-set { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.reflect.apply { "android":"4.4.3", "ie":"10" }
  es6.reflect.construct { "android":"4.4.3", "ie":"10" }
  es6.reflect.define-property { "android":"4.4.3", "ie":"10" }
  es6.reflect.delete-property { "android":"4.4.3", "ie":"10" }
  es6.reflect.get { "android":"4.4.3", "ie":"10" }
  es6.reflect.get-own-property-descriptor { "android":"4.4.3", "ie":"10" }
  es6.reflect.get-prototype-of { "android":"4.4.3", "ie":"10" }
  es6.reflect.has { "android":"4.4.3", "ie":"10" }
  es6.reflect.is-extensible { "android":"4.4.3", "ie":"10" }
  es6.reflect.own-keys { "android":"4.4.3", "ie":"10" }
  es6.reflect.prevent-extensions { "android":"4.4.3", "ie":"10" }
  es6.reflect.set { "android":"4.4.3", "ie":"10" }
  es6.reflect.set-prototype-of { "android":"4.4.3", "ie":"10" }
  es6.promise { "android":"4.4.3", "chrome":"49", "ie":"10" }
  es6.symbol { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.object.assign { "android":"4.4.3", "ie":"10" }
  es6.object.is { "ie":"10" }
  es6.object.set-prototype-of { "android":"4.4.3", "ie":"10" }
  es6.function.name { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.string.raw { "android":"4.4.3", "ie":"10" }
  es6.string.from-code-point { "android":"4.4.3", "ie":"10" }
  es6.string.code-point-at { "android":"4.4.3", "ie":"10" }
  es6.string.repeat { "android":"4.4.3", "ie":"10" }
  es6.string.starts-with { "android":"4.4.3", "ie":"10" }
  es6.string.ends-with { "android":"4.4.3", "ie":"10" }
  es6.string.includes { "android":"4.4.3", "ie":"10" }
  es6.regexp.flags { "android":"4.4.3", "edge":"14", "ie":"10" }
  es6.regexp.match { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.regexp.replace { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.regexp.split { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.regexp.search { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.array.from { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es6.array.of { "android":"4.4.3", "ie":"10" }
  es6.array.copy-within { "android":"4.4.3", "ie":"10" }
  es6.array.find { "android":"4.4.3", "ie":"10" }
  es6.array.find-index { "android":"4.4.3", "ie":"10" }
  es6.array.fill { "android":"4.4.3", "ie":"10" }
  es6.array.iterator { "android":"4.4.3", "ie":"10" }
  es6.number.is-finite { "ie":"10" }
  es6.number.is-integer { "android":"4.4.3", "ie":"10" }
  es6.number.is-safe-integer { "android":"4.4.3", "ie":"10" }
  es6.number.is-nan { "ie":"10" }
  es6.number.epsilon { "android":"4.4.3", "ie":"10" }
  es6.number.min-safe-integer { "android":"4.4.3", "ie":"10" }
  es6.number.max-safe-integer { "android":"4.4.3", "ie":"10" }
  es6.number.parse-float { "android":"4.4.3", "ie":"10" }
  es6.number.parse-int { "android":"4.4.3", "ie":"10" }
  es6.math.acosh { "android":"4.4.3", "ie":"10" }
  es6.math.asinh { "android":"4.4.3", "ie":"10" }
  es6.math.atanh { "android":"4.4.3", "ie":"10" }
  es6.math.cbrt { "android":"4.4.3", "ie":"10" }
  es6.math.clz32 { "android":"4.4.3", "ie":"10" }
  es6.math.cosh { "android":"4.4.3", "ie":"10" }
  es6.math.expm1 { "android":"4.4.3", "ie":"10" }
  es6.math.fround { "android":"4.4.3", "ie":"10" }
  es6.math.hypot { "android":"4.4.3", "ie":"10" }
  es6.math.imul { "ie":"10" }
  es6.math.log1p { "android":"4.4.3", "ie":"10" }
  es6.math.log10 { "android":"4.4.3", "ie":"10" }
  es6.math.log2 { "android":"4.4.3", "ie":"10" }
  es6.math.sign { "android":"4.4.3", "ie":"10" }
  es6.math.sinh { "android":"4.4.3", "ie":"10" }
  es6.math.tanh { "android":"4.4.3", "ie":"10" }
  es6.math.trunc { "android":"4.4.3", "ie":"10" }
  es7.array.includes { "android":"4.4.3", "ie":"10" }
  es7.object.values { "android":"4.4.3", "chrome":"49", "ie":"10", "ios":"10", "safari":"10" }
  es7.object.entries { "android":"4.4.3", "chrome":"49", "ie":"10", "ios":"10", "safari":"10" }
  es7.object.get-own-property-descriptors { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10", "ios":"10", "safari":"10" }
  es7.string.pad-start { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  es7.string.pad-end { "android":"4.4.3", "chrome":"49", "edge":"14", "ie":"10" }
  web.timers { "android":"4.4.3", "chrome":"49", "edge":"14", "firefox":"54", "ie":"10", "ios":"10", "safari":"10" }
  web.immediate { "android":"4.4.3", "chrome":"49", "edge":"14", "firefox":"54", "ie":"10", "ios":"10", "safari":"10" }
  web.dom.iterable { "android":"4.4.3", "chrome":"49", "edge":"14", "firefox":"54", "ie":"10", "ios":"10", "safari":"10" }
src/in.js -> lib/in.js

This issue has been moved to babel/babel#6603.