Skip to content

Could we introduce a lottie-react/light version of this package #124

@Sheraff

Description

@Sheraff

Is your feature request related to a problem? Please describe.
The lottie-react package is a little heavy.

Describe the solution you'd like
I have a PR open on the lottie-web repo (airbnb/lottie-web#3164) which exposes a new entrypoint import Lottie from 'lottie-web/light' based on the already existing "light" build (SVG renderer, no Expressions). This entrypoint already exists technically, it's just not currently exposed as an export from the package. So this PR seems sensible (to me at least!) and we could even end up exposing other variants of the package (see PR for more details).

If that PR gets merged, it would be nice to forward those changes to lottie-react as well, for example by exposing a similar entrypoint import Lottie from 'lottie-react/light'. For reference, using lottie-web/light in a modern ESM project results in 61.9KB (gzipped) chunk, whereas regular lottie-web is 97.37KB, or a 36% reduction in size.

I had a quick look through the repo, I see lottie-web is imported in a few places. Maybe variants could simply be a matter of exporting more configs from the rollup config, using aliases to replace lottie-web by lottie-web/light. (And then exposing those other builds through package.json#exports).

Describe alternatives you've considered
Lazy loading the package on demand, while showing a highly-compressed PNG of the 1st frame of the animation while it loads. This works pretty well, but I'd love to do better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions