You may not get that side effect. I haven't, and I did get it from a heart medication I take. Your mileage may vary, of course.
There is another antiviral called famvir. Hair loss isn't a known side effect of that. However, it is more expensive, usually, though it has also been studied and does reduce shedding, and therefore, probably transmission -
https://pubmed.ncbi.nlm.nih.gov/17538513/
Valtrex is a little better for reducing shedding -
https://pubmed.ncbi.nlm.nih.