Migrate from v3 to v4
mainVersion 4 introduces a breaking change regarding how dictionaries are handled. In v3, dictionaries were included by default. In v4, you must explicitly provide the dictionaries array in the configuration object to enable tree-shaking and reduce bundle size.
// v3 (Deprecated)
import { uniqueNamesGenerator } from 'unique-names-generator';
const randomName = uniqueNamesGenerator();
// v4 (Current)
import { uniqueNamesGenerator, adjectives, colors, animals } from 'unique-names-generator';
const config = { dictionaries: [adjectives, colors, animals] };
const randomName = uniqueNamesGenerator(config);