Skip to content

Code transformation for Chrome 47 breaks since compat-data v7.26.5 #17083

@Aziz-JH

Description

@Aziz-JH

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

const isPrimitive = (value) => (value === null || (typeof value != 'object' && typeof value != 'function'));

https://babeljs.io/repl#?browsers=chrome%2047&build=&builtIns=false&corejs=3.21&spec=false&loose=false&code_lz=MYewdgzgLgBAlhACgJzgWzlOA3ApjAXhgApsBDAGwFdcBKQgPhPOvwPZjCoopgB8-JKAE8ADrhAAzGCxowAhEQDkIAEYArXMChKYAMj0wR4qTMpzFMJZKphtccEtq0A3ACggA&debug=false&forceAllTransforms=false&modules=false&shippedProposals=false&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env&prettier=false&targets=&version=7.26.6&externalPlugins=&assumptions=%7B%7D

Configuration file name

babel.config.json

Configuration

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "modules": "umd",
        "targets": {
          "chrome": "47"
        }
      }
    ]
  ]
}

Current and expected behavior

The code should be transformed without any errors.

Environment

It’s possible that this issue started with this PR #17031, as the transform-typeof-symbol module was added in it.

  • Binaries:
    • Node: 22.13.0
    • npm: 10.9.2
  • npmPackages:
    • @babel/cli: 7.26.4 => 7.26.4
    • @babel/compat-data: 7.26.5 => 7.26.5
    • @babel/core: 7.26.0 => 7.26.0
    • @babel/preset-env: 7.26.0 => 7.26.0
    • @babel/preset-typescript: 7.26.0 => 7.26.0
    • babel-jest: 29.7.0 => 29.7.0
    • babel-plugin-add-module-exports: 1.0.4 => 1.0.4
    • babel-plugin-const-enum: 1.2.0 => 1.2.0

Possible solution

We are currently excluding transform-typeof-symbol.

I think it might also be possible to fix the problem by adding @babel/plugin-transform-arrow-functions for Chrome 47, but I’m not 100% sure if there are other issues or potential side effects from changing the Chrome version of the @babel/plugin-transform-arrow-functions plugin.

Additional context

Error message:

/repl.js: Cannot read properties of undefined (reading '0')

Metadata

Metadata

Assignees

No one assigned

    Labels

    i: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions