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

[v2] build size is too large #328

Closed
pimlie opened this issue Mar 10, 2019 · 3 comments
Closed

[v2] build size is too large #328

pimlie opened this issue Mar 10, 2019 · 3 comments

Comments

@pimlie
Copy link
Collaborator

pimlie commented Mar 10, 2019

When working on v2.0 I was advised to follow the doctrine of letting the transpiler worry about language features, but it seems this resulted in a hugh increase in package size. Current v2 minified size is ~30KB

Possible solutions:

  • fix the build (maybe I am missing a magic feature in the rollup config?)
  • refactor to dont use 'modern' language features
  • create separate umd-classic and umd-modern builds with modern being the default
@pimlie
Copy link
Collaborator Author

pimlie commented Mar 11, 2019

resolved through bffc742, b42618c and a79d83d

@pimlie pimlie closed this as completed Mar 11, 2019
@manniL
Copy link
Member

manniL commented Mar 11, 2019

Really wondering how object spread/object assign already causes trouble/issues there.

The current workaround is decent but I'd suggest finding the root cause in a future version so we can keep using new features in the code ☺️

@pimlie
Copy link
Collaborator Author

pimlie commented Mar 11, 2019

What I did was remove babel, add buble, imported a polyfill.js in browser.js and added to the polyfill module

import 'core-js/modules/es6.array.includes'

Thats where the 4KB came from, without the single polyfill it was 10KB, with 14+KB

I also simply checked babel's polyfilled 30KB gzipped lib to see what was in it. Eg it also contained quite a bit of stuff about regexes, probably because the polyfills not only enable features but also fix wrong behaviour without checking whether the exact cases where that wrong behaviour is triggered are at all used in the source. The only regexes which we use are in eg escape() and I checked by converting all regexes to simple string replacements but that didnt change anything in size.

Could very well be that I am wrong in my observations, but for now I will leave this issue as is. Also please note that this has never been an issue before due to the major difference between buble and babel. For good comparison we should probably take the current v1 codebase and see what babel tries to polyfill, I will leave that to you if you think thats interesting ;)

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

No branches or pull requests

2 participants