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

[preset-env] ios8 Computed property names wont transfer in strict mode #10503

qiyunbao opened this issue Sep 27, 2019 · 2 comments


Copy link

commented Sep 27, 2019

Bug Report

Current Behavior
when set env target to ios8, @babel/preset-env won‘t transform Computed property names syntax, which in ios8 is not fully support in strict mode.

Input Code

(function () {
   "use strict";
    var C = {
       y: '12',
       m: '13',
   var result = {
      [C.y]: 'abc',
      [C.m]: 'cde',

Expected behavior/code
If the target is set to ios8, babel-env should transfer the code to es5, but now it will keep the syntax and ios8 will throw an Error like this SyntaxError: Attempted to redefine proerty '12'

In, it says ios 8 support Computed property names Syntax, but the true is, it has some bug in strict mode. the code above will throw error, If you useing only one [C.y] or only [C.m] it is ok, but together it will throw the error,in none strict mode, is is ok too. I believe it is some werid bug in ios 8 webview

Babel Configuration (.babelrc, package.json, cli command)

// preset-env's config
  "targets": { "ios": 8 }


  • Babel version(s): 7.4.3
  • Node/npm version: Node 10/npm 6
  • OS: ios8.4
  • How you are using Babel: loader

Possible Solution

this Syntax should be transfer to es5 in ios8 target

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.


This comment has been minimized.

Copy link

commented Sep 27, 2019

Hey @qiyunbao! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."


This comment has been minimized.

Copy link

commented Sep 27, 2019

The browser feature data in preset-env is aligned to caniuse. In this data every browser will have a range of versions in which the feature is natively supported. We would not mark any specific version as unsupported if the implementation is faulty under some edge cases.

Note that you can use include option of preset-env to enable @babel/plugin-transform-computed-properties.

// preset-env's config
  "targets": { "ios": 8 },
  "include": ["@babel/plugin-transform-computed-properties"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.