Skip to content

ES6 not compiling #278

Closed
Closed
@desmondhume

Description

@desmondhume

I'm trying to use ES6 features in this react component:

import React from "react/addons";
import {GoogleMaps} from "react-google-maps";

class SimpleMap extends React.Component {
  render () {
    const {props, state} = this,
          {googleMapsApi} = props;
    return (
      <GoogleMaps containerProps={{
          style: {
            height: "100%",
          },
        }}
        googleMapsApi={google.maps}
        zoom={8}
        center={{lat: -34.397, lng: 150.644}} />
    );
  }

}

export default SimpleMap;

but I keep getting this error no matter what i do:

Error: Parse Error: Line 2: Illegal import declaration
  (in `[...]app/assets/javascripts/components/simple_map.js.jsx`)

I'm using react-rails along with browserify-rails.

In my config/application.rb I put:

config.react.jsx_transform_options = {
  harmony: true
}

I don't know what to try next...any suggestion/idea?

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