Search code examples
playframeworkecmascript-6transpiler

Play framework ES6->ES5 transpiler?


Is there an easy way to set up Play Framework (2.4.x, the current stable version) to transpile ES6 assets to ES5 on the fly, similar to how you can set it up to use the closure compiler to minify Javascript?


Solution

  • sbt-web is the place to go when you need anything related to build client side assets in Playframework projects. There is a plugin listed that maybe can solve your problem: sbt-traceur. This plugin uses traceur-compiler to transpile ES6 assets to ES5.

    Edit:

    Apparently, there is also an unlisted plugin that uses BabelJS:

    https://github.com/stonexx/sbt-babeljs