1

i just install babeljs and try to translate my test code in file.js:

"use strict";

class Some {
  constructor(text = 'hello from es6') {
    console.log(text)
  }
}

but after run babel file.js --out-file file.compile.js i have the same contents in file.compile.js

next i try example from babel cli usage page:

babel-node -e "class Test { }"

and i get errors:

[eval]:1
class Test {}
^^^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at Object.exports.runInThisContext (vm.js:53:16)
at _eval (c:\Users\123\AppData\Roaming\npm\node_modules\babelcli\lib\_babel-node.js:102:26)
at Object.<anonymous> (c:\Users\123\AppData\Roaming\npm\node_modules\babel-cli\lib\_babel-node.js:122:16)
at Module._compile (module.js:425:26)
at Object.Module._extensions..js (module.js:432:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:457:10)
at startup (node.js:136:18)
at node.js:972:3

my configuration:
os: windows 10
node: v5.0.0
npm: 3.3.6
babel: 6.1.1 (babel-core 6.0.20)

sorry for my english.

Community
  • 1
  • 1
Justillusion
  • 113
  • 1
  • 5

0 Answers0