Checking in node_module was the community standard but now we also have an option to use shrinkwrap. The latter makes more sense to me but there is always the chance that someone did “force publish” and introduced a bug. Are there any additional drawbacks?
Checking in node_module was the community standard but now we also have an option
Share
My favorite post/philosophy on this subject goes all the way back (a long time in node.js land) to 2011:
https://web.archive.org/web/20150116024411/http://www.futurealoof.com/posts/nodemodules-in-git.html
To quote directly:
I think this is still the best advice.
The force-publish scenario is rare and
npm shrinkwrapwould probably work for most people. But if you’re deploying to a production environment, nothing gives you the peace-of-mind like checking in the entirenode_modulesdirectory.Alternately, if you really, really don’t want to check in the
node_modulesdirectory but want a better guarantee there hasn’t been a forced push, I’d follow the advice innpm help shrinkwrap:Of course, someone could run a weird
git rebaseor something and modify a git commit hash… but now we’re just getting crazy.