Skip to content

Instantly share code, notes, and snippets.

@kulakowka
Created July 29, 2015 12:36
Show Gist options
  • Save kulakowka/8fac104630e2d8f950fd to your computer and use it in GitHub Desktop.
Save kulakowka/8fac104630e2d8f950fd to your computer and use it in GitHub Desktop.
Add Babel as a dependency to your app's package.json file and define a start script

Add Babel as a dependency to your app's package.json file and define a start script:

{
  "dependencies": {
    "babel": "4.7.16"
  },
  "scripts": {
    "start": "./node_modules/.bin/babel-node ./app.js"
  }
}

Then you can simply execute the following command to run your app:

npm start

If you ever decide to stop using Babel (e.g. once Node.js supports all of the ES6/7 features), you can just update your package.json to the following:

{
  "dependencies": {},
  "scripts": {
    "start": "node ./app.js"
  }
}

One benefit of this is that the command to run your app remains the same, which helps if you are working with other developers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment