Heat the milk and vanilla until steaming.
In a bowl, whisk sugar, egg yolks, and cornflour until pale.
Slowly pour the warm milk into the egg mixture while whisking continuously.
Return everything to the saucepan.
Cook over medium-low heat, stirring constantly for 8–10 minutes until thick.
Remove from heat and stir in the butter.
Cover the surface with baking paper and cool completely.
Refrigerate until needed.