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

Conflicting behavior run with babel-node and node, see my script in issue body. #10679

Open
shenxiang11 opened this issue Nov 8, 2019 · 3 comments

Comments

@shenxiang11
Copy link

@shenxiang11 shenxiang11 commented Nov 8, 2019

Bug Report

Current Behavior
babel-node returns undefined
node throws an error ReferenceError: x is not defined

Input Code

var x = 1;

function foo(x = x) {
  console.log(x)
}

foo()
@babel-bot

This comment has been minimized.

Copy link
Collaborator

@babel-bot babel-bot commented Nov 8, 2019

Hey @shenxiang11! 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."

@qodesmith

This comment has been minimized.

Copy link

@qodesmith qodesmith commented Nov 10, 2019

What's the expected result? I ran that in Chrome's console and it threw a different error:

Uncaught ReferenceError: Cannot access 'x' before initialization
@shenxiang11

This comment has been minimized.

Copy link
Author

@shenxiang11 shenxiang11 commented Nov 11, 2019

@qodesmith
I'm not sure if babel-node and node should has same behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.