-
-
Notifications
You must be signed in to change notification settings - Fork 882
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
docs: rewrite tree-shaking part #549
Conversation
Shinigami92
commented
Feb 23, 2022
Codecov Report
@@ Coverage Diff @@
## main #549 +/- ##
=======================================
Coverage 99.34% 99.34%
=======================================
Files 1920 1920
Lines 176368 176368
Branches 904 906 +2
=======================================
+ Hits 175211 175213 +2
+ Misses 1101 1099 -2
Partials 56 56
|
Content is good. Needs some rephrasing. Will check it out in a bit. |
I'm following the instructions above. Do you expect import { faker } from '@faker-js/faker to be tree-shaken? I wrote this in my other comment, but nothing is tree-shakeable right now. Steps to reproduce:# clone faker
npm init vite
# (say yes to everything)
cd vite-project
pnpm install
cd ..
pnpm link --dir ./vite-project Modify the JS to import faker. // within main.js
import { faker } from '@faker-js/faker'
console.log(faker.locales) // shows all locales Build and preview the dist for vite pnpm vite build # See that the gzipped version is 678kb, should be ~200ish kb If you modify the import to We need to rewrite the docs to say that tree-shaking isn't supported right now, or we need to change the way we export the Faker class. |
@JessicaSachs 600kb seems really accurate, we really have that much for the english locales. |
@JessicaSachs #548 will solve the tree-shaking problem for locale imports |
@JessicaSachs could you have a new look into this? Now that #548 is merged? |
Not sure how to proceed here and no response yet from @JessicaSachs 🤔 |
This is good! I'm sorry I hadn't checked back in. Some wording can be improved but it is good as-is. |