Questions tagged [babel-cli]

61 questions
14
votes
7 answers

How to use babel-node with pm2

I want to manage my node process with pm2 package. If I don't have any es6 syntax in my code so I don't need to add babel-node, and without any es6 syntax code is am able to run my code with pm2 with this line of code pm2 start server.js But as…
jsDevia
  • 1,282
  • 4
  • 14
  • 37
12
votes
2 answers

What is the difference between babel-cli and @babel/cli?

What is the difference between @babel/node and babel-node? I did yarn add babel-node --dev but I had error. So I did yarn add @babel/node --dev, it worked. What is the meaning of @?
brouk.develop
  • 175
  • 1
  • 14
9
votes
0 answers

How to pass options to plugins when using babel-cli

Is it possible to declare plugin options in the babel-cli --plugins argument? I can't find any mention or examples in the documentation. Specifically I'm trying to translate the following from a .bashrc file (as described here) into a babel-cli…
Alex Broadwin
  • 1,288
  • 11
  • 23
6
votes
1 answer

npx babel not reading configuration from babel.config.js

When running npx babel index.js from the command line, I was hoping I would see my babel configurations being applied from babel.config.js However it does not seem the case as was wondering why this might be? // babel.config.js module.exports =…
Max Collier
  • 573
  • 8
  • 24
6
votes
2 answers

Babel output paths to maintain directory structure of input paths

Given the following example directory structure: srcDir/file1.js srcDir/subDir1/file2.js srcDir/subDir2/file3.js I want to process those files with babel-cli so that the output files end up in destDir with the same relative directory…
Mercalli
  • 700
  • 6
  • 16
6
votes
4 answers

How to pass options to node when using babel-node

Babel CLI docs (https://babeljs.io/docs/usage/cli/): babel-node [options] [ -e script | script.js ] [arguments] But when trying to increase allocated memory for Node: babel-node --max-old-space-size=16384 script.js argument…
5
votes
0 answers

What are some ways to override local babelrc configurations?

I have a .babelrc file with certain configurations that I want to override in select situations (not environment-related). Unfortunately, babel documentation is not very clear on order of precedence for configs that are passed(i.e., .babelrc,…
Hammy1409
  • 61
  • 2
4
votes
1 answer

`npm install @babel/cli` says "WARN deprecated" for four modules. How can I fix these deprecations?

My setup MacOS = Catalina 10.15.4 (latest version) nvm = 0.35.3 (latest version) node.js = 12.16.3 (latest LTS version). Installed inside of nvm directories. npm = 6.14.4 (latest version). Installed inside of nvm directories. note: no global…
srWebDev
  • 374
  • 1
  • 7
  • 17
4
votes
0 answers

Babel Moving Comments

So I'm using babel-cli and it seems to be moving my comments to different lines. Is there any way I can tell babel to leave comments alone? For instance: console.log('woof'); // x = () => { console.log('woof'); } //…
user1375026
  • 403
  • 4
  • 12
  • 23
4
votes
1 answer

Import es6 module in repl

I wrote an es6 module that I'm transpiling with Babel.js and packaging with Webpack. I would like to be able to load this module into a repl so that I can use it there, so I installed babel-cli to get babel-node. I saw the notice saying that…
Brian McCutchon
  • 8,354
  • 3
  • 33
  • 45
3
votes
0 answers

babel ignore node_modules copying node_modules to build folder

I am trying to use es6 in my node 14+ app transpiling using babel 7.18.6. I added below build step to my npm script "build": "babel . --ignore node_modules,.platform --copy-files --no-copy-ignored --delete-dir-on-start --out-dir dist" But it still…
ajay
  • 328
  • 1
  • 5
  • 17
3
votes
2 answers

Can not transform code with babel transform with config file

This is the config file: { "presets": [ "@babel/preset-env" ], "plugins": [ "@babel/plugin-transform-modules-commonjs" ] } This is the command: npx babel src/* --out-dir build The CLI output is src/script.js ->…
tscpp
  • 1,298
  • 2
  • 12
  • 35
3
votes
1 answer

Babel doesn't transpile subfolders

My folder structure: package.json src ├── backend │ ├── routes │ │ ├── myRoute.js ├── index.js ├── .babelrc The command i run from package.json: "build:server": "babel src/backend/ -d dist" The resulting dist folder structure: dist ├── src │ …
Infamous911
  • 1,441
  • 2
  • 26
  • 41
3
votes
1 answer

How do I tell Babel CLI to ignore any path with "__" in it?

"@babel/cli": "^7.2.3", Seems really simple. https://babeljs.io/docs/en/babel-cli#ignore-files babel src --out-dir lib --ignore "src/**/*.spec.js","src/**/*.test.js" So I set it up like so: babel src --out-dir cjs --ignore "**/_*" --copy-file…
jcollum
  • 43,623
  • 55
  • 191
  • 321
3
votes
0 answers

Babel extensions

How do I specify different extensions for babel to revolve, like webpack's resolve.extensions? I want to use .web.js in my browser build and (something like) .server.js for my node server files, so that this: import foo from './foo'; Will import…
1
2 3 4 5