scalacenter / scalajs-bundler

https://scalacenter.github.io/scalajs-bundler
Other
235 stars 101 forks source link

Providing `nodeExecCommand` setting #427

Open ptrdom opened 2 years ago

ptrdom commented 2 years ago

This is somewhat related to https://github.com/scalacenter/scalajs-bundler/issues/418 - instead of directly supporting some node version manager, we could expose a setting that would allow users to set a node executable, similar to how sbt-native-packager does it with dockerExecCommand. Then users of scalajs-bundler could wire in for example https://github.com/jasongin/nvs by setting nodeExecCommand to nvs exec <ver>.

How does this sound @sjrd?

sjrd commented 2 years ago

This is something that can be done with a custom NodeJSEnv.Config:

import org.scalajs.jsenv.nodejs.NodeJSEnv

jsEnv := {
  new NodeJSEnv(NodeJSEnv.Config()
    .withExecutable("nvs")
    .withArgs(List("exec", ver)))
}
ptrdom commented 2 years ago

When suggesting this I mainly had interactions with Webpack in mind:

sjrd commented 2 years ago

Wouldn't that be possible to do in user space using #420, then?

ptrdom commented 2 years ago

No, because that PR does not expose these bundler related node invocations that I have linked above. New setting is the only way. Do not see a problem here - it is a beneficial change that is easily backwards compatible.