Skip to content

Reduce install size of @capsizecss/unpack #236

@delucis

Description

@delucis

Currently @capsizecss/unpack depends on fontkit, which has an install size of nearly 9 MB, making it a pretty big dependency. As a maintainer of Astro, I was curious if there was a way we could avoid the large dependency on our end, and whether we could also extend any improvements to other dependents like @nuxt/fonts.

I’d been investigating ways to reduce the install size and came up with fontkitten a module that is 20x smaller than fontkit while still providing all the APIs @capsizecss/unpack requires.

Would there be any interest in making the switch? The monthly bandwidth savings would be more than 30 TB just accounting for the users of astro and fontaine (used by Nuxt’s package).

There is one hitch though: to save space, fontkitten ships as ESM-only but @capsizecss/unpack ships both CJS and ESM currently, so this would be a breaking change for any users who needed CJS. However, more and more tools are making the switch to ESM-only these days, so maybe @capsizecss/unpack could too?

(I would have made a PR proposing the change, but crackle doesn’t appear to support an ESM-only output, so it looks like it might be a bit of work to do this.)

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