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

babel-node -b <preset> cli flag doesn't work #9349

Closed
htor opened this issue Jan 16, 2019 · 1 comment · Fixed by #10763
Closed

babel-node -b <preset> cli flag doesn't work #9349

htor opened this issue Jan 16, 2019 · 1 comment · Fixed by #10763
Labels
Has PR i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: node

Comments

@htor
Copy link

htor commented Jan 16, 2019

Bug Report

when using babel-node --presets <preset> <file> everything works but when using the shorthand variant babel-node -b <preset> <file> it doesn't.

/tmp/test $ ./node_modules/.bin/babel-node --presets @babel/preset-env test.js 
[ 1, 2, 3, 4 ]
/tmp/test $ ./node_modules/.bin/babel-node -b @babel/preset-env test.js 
internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module '/private/tmp/test/@babel/preset-env'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:775:12)
    at Object.<anonymous> (/private/tmp/test/node_modules/@babel/node/lib/_babel-node.js:234:23)
    at Module._compile (internal/modules/cjs/loader.js:722:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:775:12)

Expected behavior/code

babel-node -b <preset> should work excactly the same as babel-node --presets <preset>, according to babel-node --help.

Babel Configuration (.babelrc, package.json, cli command)

package.json:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/cli": "^7.2.3",
    "@babel/core": "^7.2.2",
    "@babel/node": "^7.2.2",
    "@babel/preset-env": "^7.2.3"
  },
  "dependencies": {
    "uniq": "^1.0.1"
  }
}

input test.js:

import uniq from 'uniq'
console.log(uniq([1, 2, 3, 4]))

Environment
macos 10.13
npm 6.5.0

@babel-bot
Copy link
Collaborator

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

@htor htor changed the title babel-node -p <env> cli flag doesn't work babel-node -b <env> cli flag doesn't work Jan 16, 2019
@htor htor changed the title babel-node -b <env> cli flag doesn't work babel-node -b <preset> cli flag doesn't work Jan 17, 2019
@JLHwung JLHwung added the Has PR label Nov 25, 2019
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Apr 11, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Has PR i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: node
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants