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

Unexpectedly Large Package Build #1

Closed
ryan-mahoney opened this issue Jul 16, 2018 · 6 comments
Closed

Unexpectedly Large Package Build #1

ryan-mahoney opened this issue Jul 16, 2018 · 6 comments

Comments

@ryan-mahoney
Copy link

Are you submitting a bug report or a feature request?

Bug report

What is the current behavior?

The distributed builds are huge, for example, the react-final-form-html5-validation.es.js is 670kb. It also contains references to things like __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner which doesn't seem right.

What is the expected behavior?

This looks like a small library, the build should also be small.

Sandbox Link

What's your environment?

final-form: ^4.8.3

react-final-form-html5-validation: 1.0.0

Other information

@ryan-mahoney
Copy link
Author

Another clue, when I build my project, it says:
[BABEL] Note: The code generator has deoptimised the styling of "/Users/ryanmahoney/Documents/ecommerce/app/node_modules/react-final-form-html5-validation/dist/react-final-form-html5-validation.es.js" as it exceeds the max of "500KB"

Removing react-final-form-html5-validation (by just aliasing it to `react-final-form in my webpack config) shaves off ~100Kb!

@erikras
Copy link
Member

erikras commented Jul 17, 2018

That's pretty weird considering the actual code is < 3kb. Bundlephobia confirms it's almost 100kb unzipped. It sure looks like the peer deps are properly specified as "external" in the rollup.config.js. 🤔

@ryan-mahoney
Copy link
Author

Yeah, I wanted to be more helpful and open a PR w/ a fix, but I've not actually bundled a library with rollup before. Hope it's an easy fix, this is a great lib ;)

@Andarist
Copy link
Contributor

Andarist commented Jul 17, 2018

Fixed by #2

@ryan-mahoney
Copy link
Author

Will you be pushing a new version to NPM?

@erikras
Copy link
Member

erikras commented Jul 18, 2018

Published fix in v1.0.1.

dist/react-final-form-html5-validation.es.js went from 730K to 5.4K. 😱

@erikras erikras closed this as completed Jul 18, 2018
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

No branches or pull requests

3 participants