When Yarn is used to install dependencies, it puts them in node-modules
directory by default.
How can I change this to i.e Laravel resources
folder?
Like .bowerrc
is used for bower to set "directory": "resources/assets"
The output directory can be changed by running yarn with the command line option --modules-folder . For example, if you wanted to install packages into a web/vendor directory instead of node_modules , you would add the modules-folder option on all yarn commands like yarn install --modules-folder web/vendor .
yarn add file:/path/to/local/folder installs a package that is on your local file system.
Yarnrc files (named this way because they must be called . yarnrc. yml ) are the one place where you'll be able to configure Yarn's internal settings. While Yarn will automatically find them in the parent directories, they should usually be kept at the root of your project (often your repository).
. yarnrc files allow you to configure additional Yarn features. The config command may also be used to set these options. Yarn will merge .
yarn install --modules-folder ./resources
UPDATE: Keep an eye on this GitHub Issue as this feature is not quite stable.
UPDATE 2: From Damien's answer below, you can add --install.modules-folder "./resources"
to a .yarnrc
file so that you don't need to continually pass the commandline argument in for each subsequent invocation. Note that double quotes are required; without those, you will get an Invalid value type 1:25
or similar error.
You can then commit the .yarnrc
to source control so that other developers on the project can use the same settings automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With