I assume when I install npm package say react for the first time with
yarn add react
this will save react file in local cache. I found .y
.y
A quite popular guy here at S.O. said:
"Read the Source, Luke!"
And here is the source of yarn CLI's --prefer-offline flag:
yarn
--prefer-offline
commander.option('--prefer-offline', 'use network only if dependencies are not available in local cache');
Enjoy!