caolan / caolan/forms

Browser bundle is very large

Open
#192 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1k
Forks
161
PR merge metrics
No merged PRs in 30d

Description

I'm currently trying to use this library for isomporphic form validation/rendering. However, this lifted my (uncompressed) JS size from ~700kb to 3.1mb.

After removing `formidable`, `async` and `qs` as dependencies (formidable has the largest contribution), and leaving the server implementation to parse form data, my bundle size is sitting at around 900kb. [You can see the fork here](https://github.com/hackcambridge/forms)

You could also remove the dependencies on shims (`object-keys`, `is`, `object.assign`, `string.prototype.trim`), if you just specified that people who want support for older browsers/runtimes need to include polyfills themselves.

That will result in zero dependencies with almost no loss in functionality. The changes being:
- You have to parse the form data before handing it over
- You have to polyfill JS features that aren't available

I know legacy support is an important feature for this library, as is ease of "plug and play" use, so I wanted to see if there was any interest in reducing dependencies.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.