scalacenter / scalajs-bundler

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

Support Node Version Manager (NVM) #418

Closed ptrdom closed 2 years ago

ptrdom commented 2 years ago

https://github.com/nvm-sh/nvm https://github.com/coreybutler/nvm-windows

NVM is used to manage Node and npm versions, what typically happens when a project is not set to a specific version of these tools is that it eventually breaks in compilation or runtime, because different developers and CI/CD machines start using incompatible versions without any means of control. It would be as if in Scala we would not be able to set sbt or Scala versions in our projects.

I think this would need a new setting to be added, maybe useNVM, which would accept a String of a Node version as a parameter.

sjrd commented 2 years ago

Thanks for the suggestion.

I'm afraid this does not make sense to me. At least it looks completely out of scope for scalajs-bundler. scalajs-bundler is not in charge of installing/managing Node.js any more than sbt-scalajs is. Or equivalent, not any more than sbt is in charge of installing/managing JVMs. This is supposed to be done completely outside of sbt.

If you feel strongly about it, you can always write a separate sbt plugin to do that.

ptrdom commented 2 years ago

This is a bit different from JVM in the fact that JVM is not as tightly coupled with sbt as npm is with Node - you typically install them together and community typically uses NVM for that. I guess that with this feature I simply wanted to make so that scalajs-bundler could fully manage the Javascript build cycle, but you are correct - that could be done with a separate plugin.