Skip to content

Bundle size query (and 8kB version) #712

@dracos

Description

@dracos

Thank you for continuing to maintain this repository. Following on from the similar #321, it looks like v3 increases the size of this package from 11.3kB minified+gzipped (or 8kB, if you tweaked the configuration as in my comment on that issue) to 18.4kB :
image.

Looking at a comparison of the actual source change between v2.0.4 and v3.0.0, with e.g. git diff v2.0.4..39a52dceb0 src/autocomplete.js (all the other src/ changes are small), there doesn't appear to be anything in there that would explain such a large increase, especially as you say you're also dropping old-IE polyfills. There's only the changes you outline in the release notes (plus #676 which appears to be missing, hope that's helpful).

I have applied the PRs (bar the additional classes which didn't cherry-pick cleanly in the time I had available) on top of my fork, it's still only 8kB and seems to work fine: https://github.com/mysociety/accessible-autocomplete/tree/v2.0.4-ms2

Diffing src shows the missing "additional classes" code, but that's all; diffing dist shows the expected changes - but the v3.0.0 file has an awful lot of extra code up front. What it appears to be doing is including a large number of core-js polyfills, e.g. Array.prototype.push (and all its internal dependents) allegedly in order to deal with the esoteric edge case of https://stackoverflow.com/a/77556853/669631. I'm unclear as to the purpose of including these polyfills in a library like this (does it really need to include a polyfill for Array.prototype.join?), that almost certainly doesn't need any of them, and more than doubles the size of the gzipped library (never mind the ungzipped). I wonder if there's a way to tweak the configuration so as not to include them?

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