es6-tutorial
es6-tutorial copied to clipboard
Babel 6 expects user to specify es2015 preset
Hey, I was following your tutorial and on step 3 about object destructuring, I kept getting an unexpected token error from the line let {monthlyPayment, monthlyRate} = calculateMonthlyPayment(principal, years, rate);
Figured out that Babel 6 wasn't transpiling es2015 by default. Fixed it by adding a .babelrc
file, reference:
{
"presets": ["es2015"]
}
Thanks for making this, it's been helpful.
use babel --preset es2015 ... instead
Hi, I was following your tutorial ,but there wasn't any file in the build directory,and I don't know what mean the es2015,is it a folder's name?
"scripts": { "babel": "babel --presets es2015 js/main.js -o build/main.bundle.js", "start": "http-server -p 9000" },
@codepandy you should create a directory and name it "build"
@duongan ok,thank you.