Packages

  • package root
    Definition Classes
    root
  • package scalajsbundler
    Definition Classes
    root
  • package sbtplugin
    Definition Classes
    scalajsbundler
  • object ScalaJSBundlerPlugin extends AutoPlugin

    This plugin enables ScalaJSPlugin and sets the scalaJSModuleKind to CommonJSModule.

    This plugin enables ScalaJSPlugin and sets the scalaJSModuleKind to CommonJSModule. It also makes it possible to define dependencies to NPM packages and provides tasks to fetch them or to bundle the application with its dependencies.

    Tasks and Settings

    The autoImport member documents the keys provided by this plugin. Besides these keys, the following existing keys also control the plugin:

    version in webpack

    Version of webpack to use. Example:

    version in webpack := "3.5.5"

    version in installJsdom

    Version of jsdom to use.

    version in startWebpackDevServer

    Version of webpack-dev-server to use.

    version in startWebpackDevServer := "2.11.1"

    crossTarget in npmUpdate

    The directory in which NPM dependencies will be fetched, and where all the .js files will be generated. The directory is different according to the current Configuration (either Compile or Test).

    Defaults to crossTarget.value / "scalajs-bundler" / "main" for Compile and crossTarget.value / "scalajs-bundler" / "test" for Test.

    Definition Classes
    sbtplugin
  • autoImport

object autoImport

Source
ScalaJSBundlerPlugin.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. autoImport
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type BundlerFile = scalajsbundler.BundlerFile
  2. type BundlerFileType = scalajsbundler.BundlerFileType
  3. type BundlingMode = scalajsbundler.BundlingMode
  4. implicit class RichBundlerFile extends SBTBundlerFile

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val BundlerFile: scalajsbundler.BundlerFile.type
  5. val BundlerFileType: scalajsbundler.BundlerFileType.type
  6. val BundlerFileTypeAttr: sbt.AttributeKey[BundlerFileType]
  7. val BundlingMode: scalajsbundler.BundlingMode.type
  8. val ProjectNameAttr: sbt.AttributeKey[String]
  9. val additionalNpmConfig: SettingKey[Map[String, JSON]]

    List of the additional configuration options to include in the generated 'package.json'.

    List of the additional configuration options to include in the generated 'package.json'. Note that package dependencies are automatically generated from npmDependencies and npmDevDependencies and should not be specified in this setting.

    import scalajsbundler.util.JSON._
    additionalNpmConfig in Compile := Map(
      "name"        -> str(name.value),
      "version"     -> str(version.value),
      "description" -> str("Awesome ScalaJS project..."),
      "other"       -> obj(
        "value0" -> bool(true),
        "value1" -> obj(
          "foo" -> str("bar")
        )
      )
    )

    Note that this key must be scoped by a Configuration (either Compile or Test).

  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native() @HotSpotIntrinsicCandidate()
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  14. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. val installJsdom: TaskKey[sbt.File]

    Locally install jsdom.

    Locally install jsdom.

    You can set the jsdom package version to install with the key version in installJsdom.

    Returns the installation directory.

  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. val jsSourceDirectories: SettingKey[Seq[sbt.File]]

    Local js source directories to be collected by the bundler

    Local js source directories to be collected by the bundler

    Default is src/main/js

  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  22. val npmDependencies: SettingKey[Seq[(String, String)]]

    List of the NPM packages (name and version) your application depends on.

    List of the NPM packages (name and version) your application depends on. You can use [semver](https://docs.npmjs.com/misc/semver) versions:

    npmDependencies in Compile += "uuid" -> "~3.0.0"

    Note that this key must be scoped by a Configuration (either Compile or Test).

  23. val npmDevDependencies: SettingKey[Seq[(String, String)]]

  24. val npmExtraArgs: SettingKey[Seq[String]]

    Additional arguments for npm

    Additional arguments for npm

    Defaults to an empty list.

  25. val npmInstallDependencies: TaskKey[sbt.File]

    Installs NPM dependencies.

    Installs NPM dependencies.

    Unlike npmUpdate this does not stage the javascript resources and so is safe to use in sourceGenerators or any other task that is used by fullClasspath.

    The plugin uses different directories according to the configuration (Compile or Test). Thus, this setting is scoped by a Configuration.

    Typically, if you want to define a task that uses the downloaded NPM packages you should specify the Configuration you are interested in:

    myCustomTask := {
      val npmDirectory = (npmInstallDependencies in Compile).value
      doSomething(npmDirectory / "node_modules" / "some-package")
    }

    The task returns the directory in which the dependencies have been fetched (the directory that contains the node_modules directory).

  26. val npmInstallJSResources: TaskKey[Seq[sbt.File]]

    Installs all JavaScript resources found on the classpath as node packages.

    Installs all JavaScript resources found on the classpath as node packages.

    Additionally, it installs also the resources found under jsSourceDirectories

    The JavaScript resources are installed locally in node_modules and can be used any other node package, such as to load a module using require().

    The plugin uses different directories according to the configuration (Compile or Test). Thus, this setting is scoped by a Configuration.

    The task returns the path to each JavaScript resource within the node_modules directory.

  27. val npmResolutions: SettingKey[Map[String, String]]

    Map of NPM packages (name -> version) to use in case transitive NPM dependencies refer to a same package but with different version numbers.

    Map of NPM packages (name -> version) to use in case transitive NPM dependencies refer to a same package but with different version numbers. In such a case, this setting defines which version should be used for the conflicting package. Example:

    npmResolutions in Compile := Map("react" -> "15.4.1")

    If several Scala.js projects depend on different versions of react, the version 15.4.1 will be picked. But if all the projects depend on the same version of react, the version given in npmResolutions will be ignored.

    If different versions of the packages are referred but the package is NOT configured in npmResolutions, a version conflict resolution is delegated to npm/yarn. This behavior may reduce a need to configure npmResolutions explicitly. E.g. "14.4.2" can be automatically-picked for ">=14.0.0 14.4.2 ^14.4.1".

    Note that this key must be scoped by a Configuration (either Compile or Test).

  28. val npmUpdate: TaskKey[sbt.File]

    Installs NPM dependencies and all JavaScript resources found on the classpath as node packages.

    Installs NPM dependencies and all JavaScript resources found on the classpath as node packages.

    The JavaScript resources are installed locally in node_modules and can be used any other node package, such as to load a module using require().

    Do not use this from sourceGenerators or any other task that is used either directly or indirectly by fullClasspath otherwise it will result in a deadlock. For this, use npmInstallDependencies instead.

    The plugin uses different directories according to the configuration (Compile or Test). Thus, this setting is scoped by a Configuration.

    The task returns the directory in which the dependencies have been fetched (the directory that contains the node_modules directory).

  29. val requireJsDomEnv: TaskKey[Boolean]

    A flag to indicate the need to use a DOM enabled JS environment in test.

    A flag to indicate the need to use a DOM enabled JS environment in test.

    Default is false.

  30. val startWebpackDevServer: TaskKey[Unit]

    Start background webpack-dev-server process.

    Start background webpack-dev-server process.

    If webpack-dev-server is already running, it will be restarted.

    The started webpack-dev-server receives the following arguments: - --config is set to value of webpackConfigFile setting. - --port is set to value of webpackDevServerPort setting. - Contents of webpackDevServerExtraArgs setting.

    See also

    stopWebpackDevServer

    webpackDevServerPort

    webpackDevServerExtraArgs

  31. val stopWebpackDevServer: TaskKey[Unit]

    Stop running webpack-dev-server process.

    Stop running webpack-dev-server process.

    Does nothing if the server is not running.

    See also

    startWebpackDevServer

  32. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  33. def toString(): String
    Definition Classes
    AnyRef → Any
  34. val useYarn: SettingKey[Boolean]

    Whether to use Yarn to fetch dependencies instead of npm.

    Whether to use Yarn to fetch dependencies instead of npm. Yarn has a caching mechanism that makes the process faster.

    If set to true, it requires Yarn 0.22.0+ to be available on the host platform.

    Defaults to false.

  35. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  37. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. val webpack: TaskKey[Seq[sbt.Attributed[sbt.File]]]

    Bundles the output of a Scala.js stage.

    Bundles the output of a Scala.js stage.

    This task must be scoped by a Scala.js stage (either fastOptJS or fullOptJS) and a Configuration (either Compile or Test).

    For instance, to bundle the output of fastOptJS, run the following task from the sbt shell:

    fastOptJS::webpack

    Or, in an sbt build definition:

    webpack in (Compile, fastOptJS)

    Note that to scope the task to a different project than the “current” sbt project, you have to write the following:

    webpack in (projectRef, Compile, fastOptJS in projectRef)

    The task returns the produced bundles.

    The task is cached, so webpack is only launched when some of the used files have changed. The list of files to be monitored is provided by webpackMonitoredFiles

    The files produced are wrapped in sbt.Attributed, and tagged with scalajsbundler.sbtplugin.SBTBundlerFile.ProjectNameAttr and scalajsbundler.sbtplugin.SBTBundlerFile.BundlerFileTypeAttr. The scalajsbundler.sbtplugin.SBTBundlerFile.ProjectNameAttr contains the "prefix" of the file names, such as yourapp-fastopt, while the scalajsbundler.sbtplugin.SBTBundlerFile.BundlerFileTypeAttr contains the bundle file type, which can be used to filter the list of files by their scalajsbundler.BundlerFileType. For example:

    webpack.value.find(_.metadata.get(BundlerFileTypeAttr).exists(_ == BundlerFileType.ApplicationBundle))
  39. val webpackBundlingMode: SettingKey[BundlingMode]

    scalajsbundler.BundlingMode to use.

    scalajsbundler.BundlingMode to use.

    Must be one of: Application - Process the entire Scala.js output file with webpack, producing a bundle including all dependencies LibraryOnly() - Process only the entrypoints via webpack and produce a library of dependencies LibraryAndApplication() - Process only the entrypoints, concatenating the library with the application to produce a bundle

    The default value is Application

  40. val webpackCliVersion: SettingKey[String]

    Version of webpack-cli

  41. val webpackConfigFile: SettingKey[Option[sbt.File]]

    configuration file to use with webpack.

    configuration file to use with webpack. By default, the plugin generates a configuration file, but you can supply your own file via this setting. Example of use:

    webpackConfigFile in fullOptJS := Some(baseDirectory.value / "my.dev.webpack.config.js")

    You can find more insights on how to write a custom configuration file in the cookbook.

  42. val webpackDevServerExtraArgs: SettingKey[Seq[String]]

    Additional arguments to webpack-dev-server.

    Additional arguments to webpack-dev-server.

    Defaults to an empty list.

    See also

    startWebpackDevServer

  43. val webpackDevServerPort: SettingKey[Int]

    Port, on which webpack-dev-server will be launched.

    Port, on which webpack-dev-server will be launched.

    Defaults to 8080.

    See also

    startWebpackDevServer

  44. val webpackEmitSourceMaps: SettingKey[Boolean]

    whether to enable (or not) source-map in a given configuration (Compile or Test) and stage (fastOptJS or fullOptJS).

    whether to enable (or not) source-map in a given configuration (Compile or Test) and stage (fastOptJS or fullOptJS). Example of use:

    webpackEmitSourceMaps in (Compile, fullOptJS) := false

    By default, this setting is undefined and scalajs-bundler fallbacks to Scala.js’ sourceMap setting, so, to globally disable source maps you can just configure the sourceMap setting:

    scalaJSLinkerConfig ~= _.withSourceMap(false)
  45. val webpackExtraArgs: SettingKey[Seq[String]]

    Additional arguments to webpack

    Additional arguments to webpack

    Defaults to an empty list.

  46. val webpackMonitoredDirectories: SettingKey[Seq[sbt.File]]

    Additional directories, monitored for webpack launch.

    Additional directories, monitored for webpack launch.

    Changes to files in these directories that match includeFilter scoped to webpackMonitoredFiles enable webpack launch in webpack task.

    Defaults to an empty Seq.

    See also

    webpackMonitoredFiles

  47. val webpackMonitoredFiles: TaskKey[Seq[sbt.File]]

    List of files, monitored for webpack launch.

    List of files, monitored for webpack launch.

    By default includes the following files:

    • Generated package.json
    • Generated webpack config
    • Custom webpack config (if any)
    • Files, provided by webpackEntries task.
    • Files from webpackMonitoredDirectories, filtered by includeFilter
    See also

    webpackMonitoredDirectories

    webpack

  48. val webpackNodeArgs: SettingKey[Seq[String]]

    node.js cli custom arguments as described in https://nodejs.org/api/cli.html

    node.js cli custom arguments as described in https://nodejs.org/api/cli.html

    Defaults to an empty list.

  49. val webpackResources: SettingKey[sbt.PathFinder]

    Webpack configuration files to copy to the target directory.

    Webpack configuration files to copy to the target directory. These files can be merged into the main configuration file.

    By default all .js files in the project base directory are copied:

    baseDirectory.value * "*.js"

    How to share these configuration files among your webpack config files is documented in the cookbook.

  50. val yarnExtraArgs: SettingKey[Seq[String]]

    Additional arguments for yarn

    Additional arguments for yarn

    Defaults to an empty list.

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] ) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Settings

Tasks

Ungrouped