babel-config-adambrgmn
My basic setup for Babel.
To make it work flawless run the following code:
$ npm install --save-dev babel-cli babel-config-adambrgmn babel-preset-{es2015,react,react-hmre,stage-0} babel-plugin-transform-runtime
Then create a new .stylelintrc
-file in your projects root folder, and add the following:
{
"extends": "babel-config-adambrgmn/.babelrc"
}
To be able to use all of the ES6 awsomeness when writing Node applications (or web applications for that matter) a basic setup for an index file would look something like this:
const fs = require('fs');
const path = require('path');
const babelrc = fs.readFileSync(path.join(process.cwd(), '.babelrc'));
let config;
try {
config = JSON.parse(babelrc);
} catch (err) {
console.error('Error parsing .babelrc');
console.error(err);
}
require('babel-register')(config);
require('babel-polyfill');
require('./src/index');
If you like this kind of setup you also have to run the following:
$ npm install --save babel-{register,polyfill}