Is there a way to use the babel client without installing it globally?
So rather than this
npm install -g babel-cli
I'd like to do this
npm install babel-cli --save-dev
Any local package's binary can be accessed inside npm scripts as if it was installed globally:
// package.json
{
"scripts": {
"build": "babel ..."
}
}
If you want to execute the binary on the command line, you can use a relative path to node_modules/.bin/
:
$ node_modules/.bin/babel ...
This is related to first example: node_modules/.bin/
is simple added to the PATH of the environment the npm scripts are executed in.
you can put something like this:
{
"scripts": {
"start": "babel-node test.js"
}
}
in your package.json
where test.js
is a script which you want to run. Now you can run it with npm start
command
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