Not quite replication, but recrystallization of dilithium, which decrystallized with use during TOS and had to be replaced, until Kirk's crew solved the problem in TVH. In those days, it seems Starfleet was always running short on dilithium and desperate for new sources. In TNG, they can't replicate it limitlessly,…