💻
How are you using Babel?
babel-loader (webpack)
Input code
Link to REPL - Note the use of .includes() in the injected helper.
Configuration file name
No response
Configuration
No response
Current and expected behavior
Current behavior
The objectWithoutProperties and objectWithoutPropertiesLoose helpers leverage array.includes() to check for properties to exclude from the object.
I believe it was part of this change several months back, which changes many .indexOf() statements to .includes() for several checks.
Expected behavior
The helper would use an ES5 compatible comparison for runtime when transform-rest-spread is applied.
Environment
- Babel version: 7.26.6
- Node: 22.2.0
- npm/Yarn version: Yarn 4
- OS: Ubuntu 24.04
- Monorepo: yes
Possible solution
I'm more than happy to tweak the code to just use .indexOf() for that helper, but I wanted to surface the issue for discussion before jumping to a solution in case there is a preferred path.
Additional context
No response
💻
How are you using Babel?
babel-loader (webpack)
Input code
Link to REPL - Note the use of
.includes()in the injected helper.Configuration file name
No response
Configuration
No response
Current and expected behavior
Current behavior
The
objectWithoutPropertiesandobjectWithoutPropertiesLoosehelpers leveragearray.includes()to check for properties to exclude from the object.I believe it was part of this change several months back, which changes many
.indexOf()statements to.includes()for several checks.Expected behavior
The helper would use an ES5 compatible comparison for runtime when
transform-rest-spreadis applied.Environment
Possible solution
I'm more than happy to tweak the code to just use
.indexOf()for that helper, but I wanted to surface the issue for discussion before jumping to a solution in case there is a preferred path.Additional context
No response