Hi,
I used to work in Microsoft Teams and the build time over there used to take about 25 minutes. It was big sync for developers' productivity.
I tried various optimizations in my local build by tuning various parameters in the package.json and changing the task runner from npm to yarn.
The most speed up I got was compiling my code on a powerful cloud instance. It cut the compile time of my code to half.
Check out this amazing tool https://stormyapp.com
It will help you reduce the compile time.
You say you sped up the build time by using a powerful cloud instance. What I would like to know is what were the specs of your local machine and the cloud instance as well as the time difference between the two.