question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Browser bundle is very large

See original GitHub issue

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

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.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
voxpellicommented, Jan 19, 2021

async gets removed as part of #218

0reactions
ljharbcommented, Jan 20, 2021

2f4ba3a4471a0a64c719d0bbcaa6e9d4b1e9ad8a has dropped the bundle size by 12% without any changes, so that’s a start. #218 seems to drop bundle sizes an additional 4% (from 1.09MB to 1.05MB). Thus, I suspect async is not the biggest contributor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Browser library bundle size is very large. · Issue #317 - GitHub
Hi! While looking into using Datadog RUM, I noticed the bundle size is much bigger than I'd expect: @datadog/browser-rum bundle analysis.
Read more >
5 Methods to Reduce JavaScript Bundle Size - Bits and Pieces
If your application bundle size increases and affects performance, you can compress them to reduce the size. Gzip and Brotli are the most...
Read more >
Small Bundles, Fast Pages: What To Do With Too Much ...
Analyze and fix JavaScript bundle performance issues with developer tools and strategies.
Read more >
How does browser support impact JavaScript bundle size?
Dropping support for older browsers, or serving separate bundles to them, ... Babel is the most popular tool used to do this transformation....
Read more >
How CommonJS is making your bundles larger - web.dev
CommonJS modules are very dynamic, which prevents JavaScript ... bundle size is still the number one reason for making browser apps slower.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found