To find out what an exoplanet is made of, look to its star
A swirling disc of dust surrounds young stars. That dust turns into pebbles, pebbles turn into rocks, and rocks form planets like Earth.