A method of making a hyperbranched amphiphilic polyester compound includes drying under vacuum a mixture of 2-(4-hydroxybutyl)-malonic acid and p-toluene sulphonic acid as catalyst. The vacuum is then released with a dry inert gas after drying. The dried mixture is heated under the inert gas at a temperature sufficient for polymerization. The inert gas is evacuated while continuing to heat the mixture. The formed polymer is then dissolved in dimethylformamide and precipitated out by adding methanol. Modifications of the method yield nanoparticles of polyesters having properties suited for coencapsulating fluorescent dyes together with therapeutic drugs, resulting in theranostic nanoparticles, that is, nanoparticles useful in both therapeutic treatments and diagnostic methods.