Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init project is not supported Android 4.4.4 #3186

Closed
zhump opened this issue Dec 26, 2018 · 1 comment
Closed

init project is not supported Android 4.4.4 #3186

zhump opened this issue Dec 26, 2018 · 1 comment

Comments

@zhump
Copy link

zhump commented Dec 26, 2018

Version

3.2.0

Reproduction link

https://codesandbox.io/s/pjqk6plz3m

Environment info

 System:
    OS: macOS 10.14.2
    CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
  Binaries:
    Node: 8.13.0 - ~/.nvm/versions/node/v8.13.0/bin/node
    Yarn: 1.12.3 - ~/.nvm/versions/node/v8.13.0/bin/yarn
    npm: 6.4.1 - ~/.nvm/versions/node/v8.13.0/bin/npm
  Browsers:
    Chrome: 71.0.3578.98
    Firefox: 61.0.2
    Safari: 12.0.2
  npmPackages:
    @vue/babel-preset-app:  3.2.0
    @vue/cli-overlay:  3.2.0
    @vue/cli-plugin-babel: ^3.2.0 => 3.2.0
    @vue/cli-plugin-eslint: ^3.2.0 => 3.2.1
    @vue/cli-service: ^3.2.0 => 3.2.0
    @vue/cli-shared-utils:  3.2.0
    @vue/component-compiler-utils:  2.3.1
    @vue/eslint-config-standard: ^4.0.0 => 4.0.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    babel-helper-vue-jsx-merge-props:  2.0.3
    babel-plugin-transform-vue-jsx:  4.0.1
    eslint-plugin-vue: ^5.0.0-0 => 5.0.0
    vue: ^2.5.17 => 2.5.21
    vue-eslint-parser:  4.0.3
    vue-hot-reload-api:  2.3.1
    vue-loader:  15.4.2
    vue-router: ^3.0.1 => 3.0.2
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.17 => 2.5.21
    vue-template-es2015-compiler:  1.6.0
    vuex: ^3.0.1 => 3.0.1
  npmGlobalPackages:

Steps to reproduce

main.js 增加

document.querySelectorAll('.dd')

import Vue from 'vue'
import App from './App.vue'
var b = document.querySelectorAll('.dd')
console.log(b.length)
var a = [...b]
a.forEach(function (item) {
})
new Vue({
  render: h => h(App)
}).$mount('#app')

What is expected?

可在Android 4.4.4上运行

What is actually happening?

var b = document.querySelectorAll('.dd')
var a = [...b]
不支持如上的es6语法转化。


image
image

我尝试着重新初始化一个babel的项目
image

.babeklrc

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "useBuiltIns": "usage"
      }
    ]
  ]
}

index.js

var b = document.querySelectorAll('.dd')
console.log(b.length)
var a = [...b]
console.log(a)

lib/index.js

"use strict";

require("core-js/modules/es6.string.iterator");

require("core-js/modules/es6.array.from");

require("core-js/modules/es6.regexp.to-string");

require("core-js/modules/es6.date.to-string");

require("core-js/modules/es7.symbol.async-iterator");

require("core-js/modules/es6.symbol");

require("core-js/modules/web.dom.iterable");

require("core-js/modules/es6.array.is-array");

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }

function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }

function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]" || Object.prototype.toString.call(iter) === "[object NodeList]") return Array.from(iter); }

function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }

var b = document.querySelectorAll('.dd');
console.log(b.length);

var a = _toConsumableArray(b);

console.log(a);

babel转化时"useBuiltIns": "usage"生效。增加了es6.array.from。但是vue-cli的'@vue/app',观察debug时,并没有识别到。

@haoqunjiang
Copy link
Member

FYI the bug is introduced here:

corejs: useBuiltIns !== false ? false : 2,

I may have misunderstood the actual meaning of this option when I added it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants