Willyham / amd-to-common

Convert requireJS AMD style defines to requireJS commonJS style defines
14 stars 15 forks source link

Add support for ES6? #3

Open tfga opened 7 years ago

tfga commented 7 years ago

amd-to-common stops at this line:

     this.init = _.once(() => {

with this error:

Error: Line 46: Unexpected token )

If I change it to use the old function syntax

     this.init = _.once(function() {

then it works ok.

amd-to-common doesn't support ES6?

tfga commented 7 years ago

Upgrading esprima to 3.1.1 did it for me.

dacalation commented 7 years ago

Would be nice to also support JSX. Upgrading to esprima 3.1.1 doesn't do that—I imagine it will need some configuration change.

ariya commented 7 years ago

JSX support in Esprima parser is easy, just use its jsx option. See http://esprima.readthedocs.io/en/3.1/syntactic-analysis.html#jsx-syntax-support for details.