infernojs / babel-plugin-inferno

Transforms JSX to InfernoJS vNodes
MIT License
79 stars 26 forks source link

Failure compiling #6

Closed NoiSek closed 8 years ago

NoiSek commented 8 years ago

Compiling JSX with the current version of babel-plugin-inferno currently fails and throws a SyntaxError.

Anecdotally, after going through all babel plugins with similar syntax, it appears all working examples are written in ES6. May or may not be related, but I solved my problem by removing a few "ES6-isms" as Babel kept running it as if it were ES5 and running into errors.

I won't speculate on why this fixes the problem, but I've opened a PR here so you can see what I had to change in order to get it to work.

Environment:

/.../node_modules/babel-plugin-inferno/lib/index.js:190
                enter(path, scope) {
                     ^
SyntaxError: Unexpected token (
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:204:20
    at Array.map (native)
    at Function.normalisePlugins (/usr/local/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:182:20)
trueadm commented 8 years ago

What version of Node are you using? Arrow functions and most ES6 is supported natively in Node now. That could be the issue.

NoiSek commented 8 years ago

Appears that was it, apparently I was on 0.12.4.

Homebrew on OS X supplies a version 70 releases behind the current stable version. Crazy.

Thanks!