es6-tutorial icon indicating copy to clipboard operation
es6-tutorial copied to clipboard

Babel 6 expects user to specify es2015 preset

Open brickaa opened this issue 9 years ago • 4 comments

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.

brickaa avatar Dec 17 '15 03:12 brickaa

use babel --preset es2015 ... instead

jerrylau91 avatar Mar 01 '16 09:03 jerrylau91

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 avatar Aug 26 '16 08:08 codepandy

@codepandy you should create a directory and name it "build"

duongan avatar May 07 '17 14:05 duongan

@duongan ok,thank you.

codepandy avatar May 08 '17 05:05 codepandy