Spatial environmental heterogeneity coupled with dispersal can promote ecological persistence of diverse metacommunities. Does this premise hold when metacommunities evolve? Using a two‐resource competition model, we studied the evolution of resource‐uptake specialisation as a function of resource type (substitutable to essential) and shape of the trade‐off between resource uptake affinities (generalist‐ to specialist‐favouring). In spatially homogeneous environments, evolutionarily stable coexistence of consumers is only possible for sufficiently substitutable resources and specialist‐favouring trade‐offs. Remarkably, these same conditions yield comparatively low diversity in heterogeneous environments, because they promote sympatric evolution of two opposite resource specialists that, together, monopolise the two resources everywhere. Consumer diversity is instead maximised for intermediate trade‐offs and clearly substitutable or clearly essential resources, where evolved metacommunities are characterised by contrasting selection regimes. Taken together, our results present new insights into resource‐competition‐mediated evolutionarily stable diversity in homogeneous and heterogeneous environments, which should be applicable to a wide range of systems.