How to use "import" in jsx file on play framework

Viewed 503

I have a problem in using to ReactRouter.

The problem is that when I try to import "Router" in jsx or js file, like so:

import { Router, Route, hashHistory } from 'react-router'

It gives me the following error:

Uncaught SyntaxError: Unexpected token import

I guess because "ECMAScript 2015 (ES6)" is not supported in a browser. How to solve this problem and use RectRouter in PlayFramework?

My env :

  1. Intellij 15

  2. Playframework 2.5

  3. sbt

In my build.sbt:

// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.0")

// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-uglify" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.0")

addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")

// ReactJS
addSbtPlugin("com.github.ddispaltro" % "sbt-reactjs" % "0.5.2")
addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.4.1")
0 Answers
Related