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

feat: split out localization files for optimized bundle #1533

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nperez0111
Copy link
Contributor

@nperez0111 nperez0111 commented Mar 16, 2025

Is a breaking change, since I had to change the export, but an easy one to make

Before:

vite v5.3.4 building for production...
✓ 168 modules transformed.
dist/webpack-stats.json   14.00 kB │ gzip:  2.39 kB
dist/style.css            11.63 kB │ gzip:  2.82 kB
dist/comments.js          17.39 kB │ gzip:  3.51 kB │ map:    49.43 kB
dist/blocknote.js        416.35 kB │ gzip: 93.27 kB │ map: 1,103.85 kB
dist/webpack-stats.json   14.01 kB │ gzip:  2.41 kB
dist/style.css            11.63 kB │ gzip:  2.82 kB
dist/comments.cjs         11.72 kB │ gzip:  2.85 kB │ map:    47.30 kB
dist/blocknote.cjs       273.46 kB │ gzip: 72.57 kB │ map: 1,044.26 kB
✓ built in 506ms

After:

vite v5.3.4 building for production...
✓ 170 modules transformed.
dist/webpack-stats.json   14.50 kB │ gzip:  2.52 kB
dist/style.css            11.63 kB │ gzip:  2.82 kB
dist/en-BEb_5vQO.js        7.78 kB │ gzip:  1.91 kB │ map:  14.03 kB
dist/comments.js          17.39 kB │ gzip:  3.51 kB │ map:  49.43 kB
dist/locales.js          135.64 kB │ gzip: 27.15 kB │ map: 238.90 kB
dist/blocknote.js        274.20 kB │ gzip: 65.23 kB │ map: 853.96 kB
dist/webpack-stats.json   14.51 kB │ gzip:  2.52 kB
dist/style.css            11.63 kB │ gzip:  2.82 kB
dist/en-DoDAHwFo.cjs       5.34 kB │ gzip:  1.76 kB │ map:  12.34 kB
dist/comments.cjs         11.72 kB │ gzip:  2.85 kB │ map:  47.30 kB
dist/locales.cjs          93.50 kB │ gzip: 24.76 kB │ map: 210.56 kB
dist/blocknote.cjs       175.52 kB │ gzip: 47.01 kB │ map: 823.91 kB
✓ built in 588ms

Shaved ~100kb from cjs

Before:
```txt
vite v5.3.4 building for production...
✓ 168 modules transformed.
dist/webpack-stats.json   14.00 kB │ gzip:  2.39 kB
dist/style.css            11.63 kB │ gzip:  2.82 kB
dist/comments.js          17.39 kB │ gzip:  3.51 kB │ map:    49.43 kB
dist/blocknote.js        416.35 kB │ gzip: 93.27 kB │ map: 1,103.85 kB
dist/webpack-stats.json   14.01 kB │ gzip:  2.41 kB
dist/style.css            11.63 kB │ gzip:  2.82 kB
dist/comments.cjs         11.72 kB │ gzip:  2.85 kB │ map:    47.30 kB
dist/blocknote.cjs       273.46 kB │ gzip: 72.57 kB │ map: 1,044.26 kB
✓ built in 506ms
```

After:

```txt
vite v5.3.4 building for production...
✓ 170 modules transformed.
dist/webpack-stats.json   14.50 kB │ gzip:  2.52 kB
dist/style.css            11.63 kB │ gzip:  2.82 kB
dist/en-BEb_5vQO.js        7.78 kB │ gzip:  1.91 kB │ map:  14.03 kB
dist/comments.js          17.39 kB │ gzip:  3.51 kB │ map:  49.43 kB
dist/locales.js          135.64 kB │ gzip: 27.15 kB │ map: 238.90 kB
dist/blocknote.js        274.20 kB │ gzip: 65.23 kB │ map: 853.96 kB
dist/webpack-stats.json   14.51 kB │ gzip:  2.52 kB
dist/style.css            11.63 kB │ gzip:  2.82 kB
dist/en-DoDAHwFo.cjs       5.34 kB │ gzip:  1.76 kB │ map:  12.34 kB
dist/comments.cjs         11.72 kB │ gzip:  2.85 kB │ map:  47.30 kB
dist/locales.cjs          93.50 kB │ gzip: 24.76 kB │ map: 210.56 kB
dist/blocknote.cjs       175.52 kB │ gzip: 47.01 kB │ map: 823.91 kB
✓ built in 588ms
```

Shaved ~100kb from cjs
Copy link

vercel bot commented Mar 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ❌ Failed (Inspect) Mar 16, 2025 1:09pm
blocknote-website ❌ Failed (Inspect) Mar 16, 2025 1:09pm

Copy link
Collaborator

@YousefED YousefED left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Q: doesn't it make more sense to split out the locales independently? I.e.: if I load Dutch, I don't need to pull in all other languages?

@nperez0111
Copy link
Contributor Author

Nice! Q: doesn't it make more sense to split out the locales independently? I.e.: if I load Dutch, I don't need to pull in all other languages?

I'd have to test, but I think they should be tree-shaked based on access. So not sure if we need to be that granular. But, I can quickly test this

@YousefED
Copy link
Collaborator

I'd have to test, but I think they should be tree-shaked based on access. So not sure if we need to be that granular. But, I can quickly test this

good point! if it's tree-shaken then it's fine 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants