Make NVM_AUTO_USE works even when loaded done #104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
hello!
My workflow requires me to open and close the terminal a lot, and I hate having to nvm load every time. Thank goodness there is a lazy load option in zsh-nvm.
I'm using it with the following settings (I use oh-my-zsh)
And I'm using yarn. In zsh-nvm, the lazy load global binaries also includes
yarn
, so when you open a new terminal, it won't be loaded, but when you use yarn commands likeyarn build
, it will be loaded and the node version will automatically be set to the default version (I think because ofnvm use default
!). It's really cool logic.The only thing is that
NVM_AUTO_USE
only works when thechpwd
event is called. I'd like it to work when nvm loaded as well.Syntax like
import packageJson from './package.json' with { type: 'json' }
doesn't work on node v18. In my situation, the nvm default is v18, so the build will fail in the following situation.So, I tried to modify
NVM_AUTO_USE
so that it works even when nvm load. Actually, I could have just used my fork repository, or simply modified the script in oh-my-zsh locally, but I thought I'd contribute in case there are more cases like mine.