You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/scala/com/typesafe/sbt/jse/SbtJsEngine.scala
+8-2
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,8 @@ object JsEngineImport {
34
34
@deprecated("No longer used", "1.3.0")
35
35
valnpmTimeout=SettingKey[FiniteDuration]("jse-npm-timeout", "The maximum number amount of time for npm to do its thing.")
36
36
valnpmNodeModules=TaskKey[Seq[File]]("jse-npm-node-modules", "Node module files generated by NPM.")
37
+
valnpmPreferSystemInstalledNpm=SettingKey[Boolean]("jse-npm-prefer-system-installed-npm","Prefer detecting and using locally installed NPM when using a local engine that provides Node support")
println("Warning: node.js detection failed, sbt will use the Rhino based Trireme JavaScript engine instead to run JavaScript assets compilation, which in some cases may be orders of magnitude slower than using node.js.")
engine.executeJs(npmFile.getOrElse(thrownewRuntimeException("No NPM JavaScript file passed to the Npm instance via the npmFile param")), args.to[immutable.Seq], Map.empty, outSink, errSink)
74
+
75
+
engine match {
76
+
caselocalEngine: LocalEngineif preferSystemNpm =>
77
+
// The first argument always is the command of the js engine, e.g. either just "node", "phantomjs,.. or a path like "/usr/bin/node"
78
+
// So, if the command is a path, we first try to detect if there is a npm command available in the same folder
println(s"Warning: npm detection failed. Falling back to npm provided by WebJars, which is outdated and will not work with Node versions 14 and newer.")
99
+
println("!!!")
100
+
executeJsNpm()
101
+
}
102
+
case _ =>// e.g. Trireme provides node, but is not a local install and does not provide npm, therefore fallback using the webjar npm
0 commit comments