I don't want to need to use .babelrc file in all cases (build script) but can't seem to find a syntax to pass nested options to the CLI. Here is a simplified version of my .babelrc that I need to pass on the command line:
{"presets": [ ["es2015", { "modules": false }] ], "compact": true }
Anyone know the syntax for this?
Well, as of Babel 7.4. 0, this powerful package had been deprecated. Composed of two dependent packages, core-js and regenerator-runtime , Babel now recommends installing them as dependencies and importing them at the top level of your application (think of index.
babelrc file is your local configuration for your code in your project. Generally you would put it in the root of your application repo. It will affect all files that Babel processes that are in the same directory or in sibling directories of the . babelrc .
You can also check the version of babel-cli by finding the babel-cli folder in node_modules and looking at the version property of the package. json that is at the base of that folder. If babel-cli was installed globally via -g flag of npm install , you could check the version by executing command babel --version .
Babel does not currently support passing options to presets or plugins via the CLI.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With