Skip to content

Instantly share code, notes, and snippets.

@aackerman
Last active August 29, 2015 14:10
Show Gist options
  • Save aackerman/637aef98fb0f6ba981d4 to your computer and use it in GitHub Desktop.
Save aackerman/637aef98fb0f6ba981d4 to your computer and use it in GitHub Desktop.
ES6 modules with webpack and 6to5
export default function add(...args){
return args.reduce( (a,b) => a + b, 0 )
}
import add from './add.js'
console.log(add(1,3,4,5));
{
"name": "gist",
"version": "0.0.0",
"description": "",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"js": "webpack && node bundle.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"6to5": "^1.14.17",
"6to5-loader": "^0.2.3",
"webpack": "^1.4.13"
}
}
module.exports = {
entry: './main.js',
output: {
filename: './bundle.js'
},
module: {
loaders: [
{ test: /\.js/, loader: '6to5-loader' }
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment