-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[Bug]: error "unknown option" raised when using @babel/node as CLI #16553
Copy link
Copy link
Closed
Labels
i: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
💻
- Would you like to work on a fix?
How are you using Babel?
@babel/register or @babel/node
Input code
Since the latest version of @babel/node I can no longer use custom args in CLI. I guess it's related to the commander update.
I've created a repo to reproduce the bug: https://github.com/j0k3r/babel-commander-bug
The first commit is using @babel/node @ 7.23.9 and the output of the scripts.js is:
$ yarn babel-node script.js --dry-run
yarn run v1.22.21
warning package.json: No license field
$ /private/tmp/babel/node_modules/.bin/babel-node script.js --dry-run
{ developer: 'bob', 'dry-run': true }
✨ Done in 1.06s.The second commit is using the latest version (ie: 7.24.6) and I got an error:
$ yarn babel-node script.js --dry-run
yarn run v1.22.21
warning package.json: No license field
$ /private/tmp/babel/node_modules/.bin/babel-node script.js --dry-run
error: unknown option '--dry-run'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.Configuration file name
package.json
Configuration
No response
Current and expected behavior
Both version should be fine with custom args in CLI.
Environment
- Babel version: 7.24.6
- node version is unrelated I guess
Possible solution
Maybe I do it wrong when using babel-node as CLI?
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
i: regressionoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue