-
-
Notifications
You must be signed in to change notification settings - Fork 931
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: use embedded build for preview examples #3343
base: next
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for fakerjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #3343 +/- ##
=======================================
Coverage 99.97% 99.97%
=======================================
Files 2811 2811
Lines 217023 217023
Branches 942 941 -1
=======================================
Hits 216972 216972
Misses 51 51 |
@@ -10,10 +10,11 @@ | |||
"generate": "run-s generate:locales generate:api-docs", | |||
"generate:api-docs": "tsx ./scripts/apidocs.ts", | |||
"generate:locales": "tsx ./scripts/generate-locales.ts", | |||
"docs:build": "run-s generate:api-docs docs:build:run", | |||
"docs:build": "run-s generate:api-docs docs:build:embedded docs:build:run", | |||
"docs:build:embedded": "tsup-node --entry.faker src/index.ts --format esm --outDir docs/public --no-dts --no-splitting --no-clean", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is embedded
the right term here? Any other suggestions?
@@ -14,4 +14,7 @@ export default defineConfig({ | |||
minify: true, | |||
sourcemap: false, | |||
splitting: true, | |||
esbuildOptions(options) { | |||
options.charset = 'utf8'; // Prevent Unicode escaping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This reduces the size from the (docs) shipped faker.js
file from 20MB to 2.7MB (due to not using unicode escape sequences!? Not sure whether there are other things at play as well).
Does that break anything for our users (in our normal builds)?
Or is there a better way to do this?
For comparison:
Branch | /dist |
/docs/public/faker.js |
---|---|---|
next |
8.6 MB | 20 MB |
this |
6.6 MB | 2.7 MB |
This appears to fix |
Thats caused by the bad Buffer polyfil. Not sure where we discussed that. EDIT: |
Fixes #3342, #3301 (comment)
internet.jwt()
fails on documentation website #3285This bundles the project into a single file and makes it available to the browser console for
next
and PRs.To keep traffic low on our website and help counting the usage of the versions, the release sites keep using the jsdelivr CDN links.
You can test it using the new language method.