-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Allow using custom config in babel-node --eval
#16642
Allow using custom config in babel-node --eval
#16642
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/57448 |
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@slatereax |
@JLHwung I added two tests, please take a look! |
Thanks, in #11877 we do load configs but they are not passed to the eval transform so the new tests are actually passing on the main branch. Can you add a simple plugin to manipulate the input source? So that we are sure the resolved config is applied. |
Done! |
babel-node --eval
Transform code for
babel-node
eval does not use the options that were passed in the cli flags. Also,replPlugin
, which is used for code transformation, only allowsvar
variables, although modern versions of node repl supportlet
andconst
.Based on the history of this file, it appears that this code was written in 2017 when node did not support any variables other than var, but there is no need for this check now. If anyone needs to use babel-node with node < 6.0.0, they can pass their configuration file through --config-file.