-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
[Bug]: Array.prototype.at parse wrong with babel/cli #112
Comments
Hey @lyz810! 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. |
{
"corejs": {
"proposals": true,
"version": "3.20.2"
} this config can add import "core-js/modules/es.array.at.js";
should only add es.array.at |
It's not that easy. Consider this example: function test() {
this.array = [];
var lastIndexOfArray = this.array.at(-1);
} If somewhere else in your application (maybe even in a different file!) you do something like this: Object.defineProperty(test.prototype, "array", {
set: () => {},
get: () => "hello!",
}); then the As you noticed, when you specify When specifying a modern
I don't know what's the difference between |
|
💻
How are you using Babel?
@babel/cli
Input code
case 1(wrong result)
case 2 (wrong result)
case 3(parse as expected)
case 4(parse as expected)
Configuration file name
No response
Configuration
Current and expected behavior
add corejs es.array.at.js, not esnext.string.at.js
recognize Array.prototype.at
Environment
System:
OS: macOS 11.6.1
Binaries:
Node: 16.13.0 - /usr/local/bin/node
npm: 8.1.0 - /usr/local/bin/npm
npmPackages:
@babel/cli: ^7.16.8 => 7.16.8
@babel/core: ^7.16.7 => 7.16.7
@babel/eslint-parser: ^7.16.5 => 7.16.5
@babel/plugin-proposal-decorators: ^7.16.7 => 7.16.7
@babel/plugin-transform-runtime: ^7.16.8 => 7.16.8
@babel/preset-env: ^7.16.8 => 7.16.8
@babel/preset-react: ^7.16.7 => 7.16.7
@babel/preset-typescript: ^7.16.7 => 7.16.7
@babel/runtime: ^7.16.7 => 7.16.7
babel-jest: ^27.4.6 => 27.4.6
babel-preset-const-enum: ^1.0.0 => 1.0.0
eslint: ^8.6.0 => 8.6.0
jest: ^27.4.7 => 27.4.7
Possible solution
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: