Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make separate export for simpleFaker #2748

Open
Semigradsky opened this issue Mar 14, 2024 · 7 comments
Open

Make separate export for simpleFaker #2748

Semigradsky opened this issue Mar 14, 2024 · 7 comments
Labels
c: feature Request for new feature has workaround Workaround provided or linked s: waiting for user interest Waiting for more users interested in this feature
Milestone

Comments

@Semigradsky
Copy link

Clear and concise description of the problem

In my vite project I use only methods from simpleFaker. But there is no separate export for this, so I use this import:

import { simpleFaker } from "@faker-js/faker"

As I see the esm/index.mjs imports all files so i have a huge bundle.

I switched to import a one locale:

import { faker as simpleFaker } from "@faker-js/faker/locale/en"

it is a much better, but not enough.

Suggested solution

I suggest to make separate export like this:

import { simpleFaker } from "@faker-js/faker/simpleFaker"

It shouldn't be hard but will nice decrease my bundle.

Alternative

No response

Additional context

No response

@Semigradsky Semigradsky added c: feature Request for new feature s: pending triage Pending Triage s: waiting for user interest Waiting for more users interested in this feature labels Mar 14, 2024
Copy link

Thank you for your feature proposal.

We marked it as "waiting for user interest" for now to gather some feedback from our community:

  • If you would like to see this feature be implemented, please react to the description with an up-vote (:+1:).
  • If you have a suggestion or want to point out some special cases that need to be considered, please leave a comment, so we are aware about them.

We would also like to hear about other community members' use cases for the feature to give us a better understanding of their potential implicit or explicit requirements.

We will start the implementation based on:

  • the number of votes (:+1:) and comments
  • the relevance for the ecosystem
  • availability of alternatives and workarounds
  • and the complexity of the requested feature

We do this because:

  • There are plenty of languages/countries out there and we would like to ensure that every method can cover all or almost all of them.
  • Every feature we add to faker has "costs" associated to it:
    • initial costs: design, implementation, reviews, documentation
    • running costs: awareness of the feature itself, more complex module structure, increased bundle size, more work during refactors

View more issues which are waiting for user interest

@xDivisionByZerox
Copy link
Member

Great suggestion. Although, with v9, we work on finally getting tree shaking to work. That way, you should get a smaller bundle regardless of the import path you import from.

@xDivisionByZerox xDivisionByZerox removed the s: pending triage Pending Triage label Mar 14, 2024
@xDivisionByZerox xDivisionByZerox added this to the v9.0 milestone Mar 14, 2024
@matthewmayer
Copy link
Contributor

matthewmayer commented Mar 14, 2024

What about

import { faker } from "@faker-js/faker/locale/base"

(gets it down to about 200KB from 500KB)

@ST-DDT ST-DDT added the has workaround Workaround provided or linked label Mar 14, 2024
@ST-DDT
Copy link
Member

ST-DDT commented Mar 14, 2024

I think that is a good workaround between the simpleFaker and fakerEn.

@matthewmayer
Copy link
Contributor

do you think its worth mentioning that option on the localization page here https://fakerjs.dev/guide/localization.html#individual-localized-packages

if so i can make a new PR for that

@xDivisionByZerox
Copy link
Member

do you think its worth mentioning that option on the localization page here fakerjs.dev/guide/localization.html#individual-localized-packages

if so i can make a new PR for that

I think the usage page would be more fitting. The localization page alredy lists "base", but doesn't give any explaination what that exactly means.

@ST-DDT
Copy link
Member

ST-DDT commented Mar 14, 2024

I think we could give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature has workaround Workaround provided or linked s: waiting for user interest Waiting for more users interested in this feature
Projects
None yet
Development

No branches or pull requests

4 participants