问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/34713267/play-framework-es6-es5-transpiler