Sofoklis
Sofoklis

Reputation: 21

Exception using scalajs-bundler Reference to undefined setting: client / npmDependencies

I get the following exception when i start sbt:

[error] Reference to undefined setting: 
[error] 
[error]   client / npmDependencies from client / npmDependencies (/home/sofoklis/workspace/playjs/build.sbt:26)
[error]      Did you mean client / Compile / npmDependencies ?
[error]  
[error] Use 'last' for the full log.
[warn] Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? (default: r)

I don't understand if something in the configuration of the projects is missing or I missed a step configuring the environment.

in plugins.sbt

logLevel := Level.Warn

addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.4.4")

addSbtPlugin("com.vmunier" % "sbt-web-scalajs" % "1.2.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.20")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4")

addSbtPlugin("ch.epfl.scala" % "sbt-web-scalajs-bundler" % "0.21.1")

addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.21.1")

build.sbt

ThisBuild / organization := "ss"
ThisBuild / scalaVersion := "2.13.5"
ThisBuild / version := "0.1.0-SNAPSHOT"

lazy val root = (project in file("."))
  .aggregate(server, client, shared.jvm, shared.js)

lazy val server = project
  .settings(
    scalaJSProjects := Seq(client),
    Assets / pipelineStages := Seq(scalaJSPipeline),
    pipelineStages := Seq(digest, gzip),
    // triggers scalaJSPipeline when using compile or continuous compilation
    Compile / compile := ((Compile / compile) dependsOn scalaJSPipeline).value,
    libraryDependencies += guice,
    libraryDependencies += "com.vmunier" %% "scalajs-scripts" % "1.2.0"
  )
  .enablePlugins(PlayScala, WebScalaJSBundlerPlugin)
  .dependsOn(shared.jvm)

lazy val client = project
  .enablePlugins(ScalaJSBundlerPlugin)
  .settings(
    scalaJSUseMainModuleInitializer := true,
    libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "1.1.0",
    npmDependencies ++= Seq(
      "jQuery" -> "3.7.0"
    )
  )
  .dependsOn(shared.js)

lazy val shared = crossProject(JSPlatform, JVMPlatform)
  .crossType(CrossType.Pure)
  .in(file("shared"))
  .jsConfigure(_.enablePlugins(ScalaJSBundlerPlugin))

I tried changing the build adding and removing plugins no solution so far.

Upvotes: 0

Views: 45

Answers (1)

Sofoklis
Sofoklis

Reputation: 21

I found the problem was to replace the line:

npmDependencies ++= Seq(

with:

Compile / npmDependencies ++= Seq(

Upvotes: 0

Related Questions