I’m using Yarn to manage my dependencies for my project. I have developer dependencies (devDependencies
) required for development and front-end dependencies (dependencies
) that my project will require and use to run. I use Git to manage my version control.
Yarn by default seems to install all dependencies in the node_modules
directory. This is fine for developer dependencies, but because I am using Git I typically ignore this directory. I would, however, like to commit my front-end dependencies and isolate them from developer dependencies.
I’m wondering if it’s possible to configure Yarn to install required dependencies in a separate directory from developer dependencies. For example:
devDependencies
would be installed in/node_modules
dependencies
would be installed in/vendor
Bower has similar functionality in the .bowerrc
file but I can't find anything similar for Yarn. I considered using Bower alongside Yarn for my front-end dependencies but that seems to defeat the purpose of using Yarn.
--cwd
was recently added to Yarn to let you do this kind of thing. github.com/yarnpkg/yarn/pull/4174 – Exultgh-pages
branch? Are you trying to make sure that the code of your dependencies never changes? – Dierdredieresis