abicky / nodejs-repl.el

Run Node.js REPL and communicate with the process
190 stars 38 forks source link

it doesn't support ES6 #7

Closed zilongshanren closed 8 years ago

zilongshanren commented 8 years ago

When write some code with ES6 features, the nodejs-repl can't work well.

> class Album{
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at Object.exports.createScript (vm.js:24:10)
    at REPLServer.defaultEval (repl.js:137:25)
    at bound (domain.js:280:14)
    at REPLServer.runBound [as eval] (domain.js:293:12)
    at REPLServer.<anonymous> (repl.js:393:12)
    at emitOne (events.js:77:13)
    at REPLServer.emit (events.js:169:7)
    at REPLServer.Interface._onLine (readline.js:210:10)
    at REPLServer.Interface._line (readline.js:549:8)
    at REPLServer.Interface._ttyWrite (readline.js:833:16)
> >   constructor(currentSales){
zilongshanren commented 8 years ago

@abicky Any suggestions?

abicky commented 8 years ago

I'm sorry for my late reply. I think the problem is the implementation of nodejs-repl-code. I'll check the implementation of the latest Node.js and support it.

zilongshanren commented 8 years ago

@abicky thanks.

abicky commented 8 years ago

I have supported NODE_REPL_MODE (https://github.com/abicky/nodejs-repl.el/commit/e5ae505fb742b75575b7e9a80beee1816fdf82fb) and released 0.0.3. Now, you can use the syntax of ES6 like below:

node> [1, 2, 3].map(v => v * 2)
[ 2, 4, 6 ]