final-form / react-final-form-html5-validation

A swap-in replacement for 🏁 React Final Form's <Field> component to provide HTML5 Validation
MIT License
57 stars 8 forks source link

Unexpectedly Large Package Build #1

Closed ryan-mahoney closed 6 years ago

ryan-mahoney commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

Fixed by #2

ryan-mahoney commented 6 years ago

Will you be pushing a new version to NPM?

erikras commented 6 years ago

Published fix in v1.0.1.

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