Skip to content

Tree-shaking not properly documented #405

Closed
@Fuzzyma

Description

@Fuzzyma

Describe the bug

Following the guide on the website, you just have to import { faker } from '@faker-js/faker';. That doesn't work. It actually makes it worse by adding a whopping 1/2MB to the bundle size.

The section above says, that you should only import what you need. Well I tried that as well:

import { address } from '@faker-js/faker' // error, no export address
import address from '@faker-js/faker/address'

address.city() // error, method not defined

So is this is supposed to work? Looking at the code, I can see why this is not treeshakeable. But why is it advertized?

Reproduction

I am using vite. So bundling is done by rollup. Using faker anywhere leads to the whole faker lib in your bundle

Additional Info

No response

Metadata

Metadata

Assignees

Labels

c: docsImprovements or additions to documentationneeds documentationDocumentations are neededp: 2-highFix main branch

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions