zenato / sbt-babel   1.2.0

MIT License GitHub

An SBT plugin to perform Babel compilation.

sbt-babel Build Status

An SBT plugin to perform Babel compilation.

Installation

To use this plugin use the addSbtPlugin command within your project's plugins.sbt file:

addSbtPlugin("io.teamscala.sbt" % "sbt-babel" % "1.2.0")

Your project's build file also needs to enable sbt-web plugins. For example with build.sbt:

lazy val root = (project in file(".")).enablePlugins(SbtWeb)

JsEngineKeys.engineType := JsEngineKeys.EngineType.Node

Install @babel/core, either globally with npm:

npm install @babel/core -g

Or locally in your project with a package.json file:

{
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "...more_dependencies": "any_version"
  }
}

Usage

For example with build.sbt:

BabelKeys.options := WebJs.JS.Object(
  "presets" -> List("@babel/preset-react")
  // More options ...
)

Or locally in your project with a .babelrc file:

{
  "presets": ["@babel/preset-react"]
}