问题
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