You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The result of some single undefined statements when using the repl via babel-node is 'use strict' when I'd expect it to be undefined.
For example, using node's repl produces:
> node
> var s = ""
undefined
While babel's repl produces:
> babel-node
> var s = ""
'use strict'
I'd expect the result of the expression to also be undefined.
Consistent output between node and babel-node seems like a reasonable thing to expect.
This is actually the same as what node prints, if you include it all on one line.
> "use strict"; var a = 2;
'use strict'
>
This doesn't have anything to do with the strict transformer specifically, what this essentially comes down to is some weirdness in the way eval works, e.g.
eval('"use strict"; var a = 2;') === 'use strict';
Seems like you'd want a plugin to automatically add an expressionStatement to the end of the code if there wasn't one (assuming that is the logic eval follows).
Program(node){
if (!t.isExpressionStatement(node.body[node.body.length - 1)){
node.body.push(t.expressionStatement(t.identifier('undefined')));
}
}
@loganfsmyth That seems to be okay, I would just be worried about an edge case where the actual result isn't being output because undefined was being pushed to the end.
The result of some single undefined statements when using the repl via babel-node is
'use strict'
when I'd expect it to beundefined
.For example, using node's repl produces:
While babel's repl produces:
I'd expect the result of the expression to also be
undefined
.in case it's relevant, my versions are:
The text was updated successfully, but these errors were encountered: