Skip to content

Instantly share code, notes, and snippets.

@fairchild

fairchild/.babelrc

Last active Dec 29, 2015
Embed
What would you like to do?
simple example of getting babel 6 running
{
"presets": ["es2015"]
}

to run,

npm start

You can not use ES6 import syntax in the same file you register in, so, require it, and then you can use import in the required files.

Alternativley, you could have require babel from the command line instead and load the file directly node -r babel-register hello.js

import webpack from 'webpack'
console.log('hello babel world')
require('babel-polyfill')
require('babel-register')
require('./hello')
{
"name": "babel-strap",
"version": "0.1.0",
"description": "sample repo to show how to setup babel6 and webpack",
"main": "index.js",
"scripts": {
"start": "BABEL_DISABLE_CACHE=1 node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"babel",
"webpack",
"es6",
"example"
],
"author": "Michael Fairchild",
"license": "MIT",
"devDependencies": {
"babel": "^6.3.26",
"babel-core": "^6.3.26",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.3.13",
"babel-register": "^6.3.13",
"webpack": "^1.12.9"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.