browserify-rails icon indicating copy to clipboard operation
browserify-rails copied to clipboard

Cannot compile React

Open chrise86 opened this issue 8 years ago • 1 comments

Using browserify-rails 3.0.0 with the following in package.json:

"devDependencies": {
    "babelify": "^7.2.0",
    "browserify": "^10.2.4",
    "browserify-incremental": "^3.0.1",
    "react": "^0.13.3",
    "reactify": "^1.1.1"
  },

application.rb:

config.browserify_rails.commandline_options = "--transform babelify --presets [ es2015 react ]"

I'm getting:

SyntaxError: /Users/chrisedwards/Sites/Personal/railsapp/app/assets/javascripts/components/notifications/notification_menu.jsx: Unexpected token (51:11)

which is pointing to:

  render() {
    return <span onClick={this.onClick} className="navbar-text"> <-- Pointing to this line
      <i className="fa fa-bell-o fa-fw fa-lg"></i>
    </span>
  }

chrise86 avatar Mar 16 '16 09:03 chrise86

do you need the parentheses in the return statement? ie,

render() {
    return (
      <span onClick={this.onClick} className="navbar-text"> <-- Pointing to this line
        <i className="fa fa-bell-o fa-fw fa-lg"></i>
       </span>
    )
  }

mtyeh411 avatar Nov 01 '16 16:11 mtyeh411