Skip to content

[proposal] Replace qs to reduce bundle size #1841

@br0p0p

Description

@br0p0p

The qs module has a lot of features but it takes up a lot of space in the resulting bundle.

According to Bundlephobia, qs and its dependencies (object-inspect, get-intrinsic) take up ~50% (~31 kB) of the final bundle: https://bundlephobia.com/package/[email protected]

Potential Alternatives

Adopting any of these options would reduce the final bundle size and dependency graph significantly.

Dependency Graph

https://npmgraph.js.org/?q=superagent

Before

Image

After

Image

picoquery

  • 7.4 kB minified, 2.4 kB minified + gzipped (source)
  • No dependencies

A barebones solution which is more spec-compliant and consistent with the URLSearchParams behavior but lacks the many of the more advanced features.

Using v1 would be necessary based superagent's current Node version and module requirements but the author is backporting fixes from later versions.

neoqs

  • 13.9 kB minified, 4.7 kB minified + gzipped (source)
  • No dependencies

A drop-in replacement for qs with a much smaller footprint. This would be the best option if backwards compatibility is a higher priority than spec compliance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions