How to override global yarn registry for particular project

China☆狼群 提交于 2019-12-21 04:43:07

问题


For most projects I pull packages from the internal server, so it's been added by

yarn config set registry http://custom-packages-server.com

But now in the new project I'd like to use the different (default) one, but use it in that particular project only. As far as I understood if I run the following command inside of new project's directory

yarn config set registry https://registry.yarnpkg.com

it's going to update global registry value for all other projects as well, so they also will be looking for packages in the new place.

So is there a possibility in yarn to override global registry record for a specific project only?


回答1:


Found the way how to achieve that.

It turned out that you can use .yarnrc file inside the project's directory (yeah, pretty much the same like .npmrc). And there you can specify custom config properties which yarn will look into first.

So that's how my .yarnrc file looks now.

registry "https://registry.yarnpkg.com"


来源:https://stackoverflow.com/questions/45998418/how-to-override-global-yarn-registry-for-particular-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!