Skip to content

Instantly share code, notes, and snippets.

@gengue
Forked from thejmazz/.babelrc
Created February 23, 2017 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gengue/f0c81af5e738ce850dd50dc508e9f836 to your computer and use it in GitHub Desktop.
Save gengue/f0c81af5e738ce850dd50dc508e9f836 to your computer and use it in GitHub Desktop.
async/await with webpack+babel
{
"presets": ["es2015"],
"plugins": ["transform-async-to-generator"]
}
async function foo() {
console.log('async working!')
}
async function bar() {
await foo()
console.log('after foo')
}
bar()
{
"name": "async-await",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"devDependencies": {
"babel-loader": "^6.2.2",
"babel-plugin-transform-async-to-generator": "^6.5.0",
"babel-polyfill": "^6.5.0",
"babel-preset-es2015": "^6.5.0",
"webpack": "^1.12.13"
}
}
module.exports = {
entry: ['babel-polyfill', './index.js'],
output: {
filename: 'bundle.js'
},
devtool: 'sourcemap',
module: {
loaders: [{
test: /\.js?$/,
exclude: /(node_modules)/,
loader: 'babel'
}]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment