List of the additional configuration options to include in the generated 'package.
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).
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.
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).
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.
Note that this key must be scoped by a Configuration (either Compile or Test).
Fetches NPM dependencies.
Fetches NPM dependencies. Returns the directory in which the npm install command has been run.
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 = (npmUpdate 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).
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.
Stop running webpack-dev-server process.
Stop running webpack-dev-server process.
Does nothing if the server is not running.
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.
Bundles the output of a Scala.
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))
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
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.
Additional arguments to webpack-dev-server.
Additional arguments to webpack-dev-server.
Defaults to an empty list.
Port, on which webpack-dev-server will be launched.
Port, on which webpack-dev-server will be launched.
Defaults to 8080.
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) := falseNote that, by default, this setting takes the same value as the Scala.js’ emitSourceMaps
setting, so, to globally disable source maps you can just configure the emitSourceMaps
setting:
emitSourceMaps := falseAdditional 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.
List of files, monitored for webpack launch.
List of files, monitored for webpack launch.
By default includes the following files:
package.jsonwebpackEntries task.webpackMonitoredDirectories, filtered by
includeFilter
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.