Skip to content

Harmony mode doesn't seem to enable itself #185

@hartator

Description

@hartator

First of all, thanks for great gem! :)

I seem to not be able to activate the harmony mode of the jsx compiler when using Rails.

I have this in my application.rb:

config.react.jsx_transform_options = {
  harmony: true,
}

One of my component, have a code like this:

 var { checked, ...other } = this.props;

It compiles fine with jsx -x jsx --harmony app/assets/javascripts/components app/assets/javascripts/components:

 var $__0=     this.props,checked=$__0.checked,other=(function(source, exclusion) {var rest = {};var hasOwn = Object.prototype.hasOwnProperty;if (source == null) {throw new TypeError();}for (var key in source) {if (hasOwn.call(source, key) && !hasOwn.call(exclusion, key)) {rest[key] = source[key];}}return rest;})($__0,{checked:1});

But, not inside Rails itself. It stays var { checked, ...other } = this.props; and I got a Uncaught SyntaxError: Unexpected token {. (Other jsx lines compile fine though.)

Any ideas? :/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions