💻
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')
💻
How are you using Babel?
Programmatic API (
babel.transform,babel.parse)Input code
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-symbolmodule was added in it.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-functionsfor 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-functionsplugin.Additional context
Error message: