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

Optimize bundle size #546

Open
felixmosh opened this issue Aug 19, 2020 · 3 comments · Fixed by #547
Open

Optimize bundle size #546

felixmosh opened this issue Aug 19, 2020 · 3 comments · Fixed by #547

Comments

@felixmosh
Copy link
Contributor

felixmosh commented Aug 19, 2020

Make a research of what can be optimized in order to reduce bundle size.

  1. Make built in validations consumed by import instead of string, this will allow to code split un-used validations. (maybe)

If anyone has more ideas, please share them here :]

@rkuykendall
Copy link
Member

So I checked the final bundle, and only 100 of the 5,500 lines are validators. Looking through the bundle, a LOT of it is lodash stuff. I tried switching to lodash-es and was able to knock quite a bit off:

- 156K	dist/formsy-react.cjs.js
+ 116K	dist/formsy-react.cjs.js
- 156K	dist/formsy-react.esm.js
+ 116K	dist/formsy-react.esm.js
- 168K	dist/formsy-react.umd.js
+ 120K	dist/formsy-react.umd.js

We could look at moving these functions into the project if we want to reduce that further. We could also look at uglifying these files, which are full of whitespace, comments, and long variable names. That doesn't really help people who are already doing that to their production files though.

@felixmosh
Copy link
Contributor Author

WOW, looks like a great savings!

@felixmosh
Copy link
Contributor Author

Moving to TSDX reduced the bundle size :]
image

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

Successfully merging a pull request may close this issue.

2 participants