-
Notifications
You must be signed in to change notification settings - Fork 1
Reduce bundle size #112
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
Comments
Another solution, though not perfect, could be to only import the library in the server side part when using SSR. So this way it doesn't get in the browser bundle. No metadata will be set for browser, but that metadata is often just needed for SEO purposes soo it's good enough. 🤔 |
See #150 some things I learned about bundle size optimizations when using non-advanced minifiers. I'd prefer to stay away from those to keep the build pipeline as simple as possible and therefore ease maintenance |
Also linked: #175 |
Aaand #181 |
Also #192 |
A bit of gain with #197 . Not the main purpose tho |
Moaaar in core in #201 |
Moaaar in core in #202 |
And #204 just 20b |
Uh oh!
There was an error while loading. Please reload this page.
Bundle size is quite too big due to lots of features being provided in there. Firstly, modules take way too much space (Open Graph, Twitter card) when they're essentially just setting some
<meta>
elements. That's preventing myself from using the library. Given I'd honestly prefer to just apply those using Angular'sMeta
service from a performance point of view.For instance, each metadata setter given it's injectable, has some overhead. So what it could be just a call to the
MetaService
to update a meta tag is envolved with much code around. Which increases the bundle size.For instance, let's look at the
DescriptionStandardMetadata
when gets compiled for production (beautified for visualisation purposes)That's 256 characters when picking it raw from the bundle (no whitespaces / new lines). So 256 bytes.
When the actual call that matters:
this.metaService.set(new Vt(Uc), n)
takes 35 chars -> 35 bytes. That's 221 bytes extra per each metadata.Those 221 bytes are dedicated to:
Which could be reduced to just 1 per each kind of metadata type (Open Graph, Twitter Card, Standard, ...)
In Open Graph, if just joining was enough, that would mean saving 6 times 221 bytes (there are 7 metadata). So 1,326B -> 1.3kB.
Let's reduce the bundle size.
For instance, by joining all metadata setters in one classSee #150 to see how a reduction was possible whilst still allowing to configure individual metadata setters 🤓
The text was updated successfully, but these errors were encountered: