-
Notifications
You must be signed in to change notification settings - Fork 82
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
Distributed module file sizes for react-sdk and optimizely-sdk are large #352
Comments
Hi twalker, Thanks for bringing this up. Improvements to module file sizes are on our roadmap. The first issue we’re planning to tackle is removing lodash (see: #241). Thanks for the clue about logging strings - we’ll take a look at this as well. |
FYI, we released v4.0.0-alpha.1 which has Lodash removed. I'll leave this issue open until we release a non-alpha version with Lodash removed. |
I'd say this can be closed now that 4.0 is no longer pre-release. The promise and lodash removal was a huge win. 🎉 !! Also shipping ES modules to support tree shaking is fantastic. However, there is one more area that I think would support a significant size reduction and that is with the validators, error handlers, and loggers... Right now the enums file contains a huge pile of error and log message strings. The first problem is that these strings cannot be minimized because they are string literals. The second problem is that the keys can't be minimized/tersered because they are object keys. (terser won't minimize keys because the keys could be invoked as dynamic property names) My suggestion would be multi-step cleanup:
|
Just did some quick spikes to get numbers on the size savings by trimming the enums module: Stubbing out (via rollup's |
Is there any more work going on in this area? Would be happy to contribute if I was given some pointers. |
Under a ticket FSSDK-8219 we've consolidated the repo and removed excess packages. We have a ticket FSSDK-9585 in progress this sprint to further reduce the package size by removing excess files (.md, non-minified scripts, etc) and not ship the /lib/ directory. I've rolled in @jasonkarns 's points. Thanks for hanging in there with us as we modify our processes to respond to Issues more efficiently. |
v4 to v5 brought in ODP and a jump in ~50kb pre-gzip. ODP introduces a dependency on ua-parser-js #854 - this is ~19KB or 12% of the total pre-gzipped size. The minified and gzipped size of v5.0.0 is 3x the size of 4.3.1! The gains of v4 were short lived and long term trend is heading upwards, how/when is this being addressed?
|
Same issue, we're shipping as much optimizely code as we are for React 🤯 Like @rupesh-checkatrade mentioned making ua-parser optional is a good start, as UA parsing should be done on the server really, we don't use the We only use |
Hello everyone, we are currently working on a major refactor of the sdk which will enable tree-shaking of the unused components like OdpManager. We are planning a release on Q1 2025. |
The following modules are pretty large in filesize, and it'd be great to have them reduced:
@optimizely/[email protected]
132kB minified
[email protected]
114kB minified
This has a notable performance impact for consumers of the modules (like me), and their end users. 244k adds over 1 second of download time (3G) and delays user interactivity.
The file size is also high in comparison with other libraries used by web apps. For example redux = 7.2kB, all of lodash = 69.2kB, vue = 63.5kB, etc.
It'd be fantastic if the bundle sizes could be reduced dramatically, down to < 50k combined.
A couple clues I'd noticed that may be useful for optimizing the size:
react-sdk
from0.2.0-beta1
(11kB) to0.3.0-beta1
(132kB)@optimizely/optimizely-sdk
version: 3.2.1@optimizely/[email protected]
version: 0.3.0-beta1Browser and version:
node
version: 10.16.0npm
version: 6.9.0The text was updated successfully, but these errors were encountered: