I am debugging why certain yarn scripts on my work laptop (mac running through a VPN) are running slowly, and have found that if I call another yarn script from the first, it takes around 8 and a half seconds consistently each time. This happens with any yarn script which calls another yarn script.
Example:
package.json
"scripts": {
"date": "date",
"date:foo": "yarn run date",
"date:bar": "yarn run date:foo"
}
result:
$ yarn run date:bar
yarn run v1.22.4
$ date; yarn run date:foo
Tue Jul 7 15:52:28 EDT 2020
$ date; yarn run date
Tue Jul 7 15:52:37 EDT 2020
$ date
Tue Jul 7 15:52:45 EDT 2020
Scripts are perfectly fast when using npm run in scripts. The problem only manifests with yarn. On my personal laptop connected to home internet, these scripts are fast.
Is there a reason yarn might take extra time here when I'm connected to a VPN? What things is yarn doing in the background that might be slowing down these kinds of scripts?