#3590·faker

Expose partial locale data for smaller bundle size

Author: ST-DDTCreated Aug 14, 2025Updated Jul 11, 2026
Labelsc: featurep: 1-normals: waiting for user interest

Clear and concise description of the problem

Currently anything inside a locale object such as en is never tree shaken even if you only need one submodule/language file from it. This applies also if you manually deconstruct and reassemble it.

Suggested solution

Add imports/exports for localization files.

E.g.

typescript
import { person } from '@faker-js/faker/locales/en';
import { firstName } from '@faker-js/faker/locales/en/person';

For my usecase it would be sufficient to get access on the module level e.g. person, but others may want to narrow it down more.

This might require some changes on how locale files are joined at least if the imports should be most convinient.

typescript
// module.ts
export first_name from './first_name';
// locale.ts
export * as person from './person';

Alternative

Alt1) Provide other ways to access subsets of locales.

Alt2) Combine #2667 with pre-built per locale nano instances.

Additional context

No response