Skip to content

🐛 [Bug]: Bundle sizes have massively increased over past releases. #471

@herre-ixxi

Description

@herre-ixxi

Package

@storyblok/richtext (Rich Text Renderer)

Bug Description

In @storyblok/richtext 3.5.0 the total size of the package was still 37,5kb. Overall really nice for the features provided.

In 3.6.0 this increased to 168kb
In 3.7.0 this became 419kb
In 4.0.0 this became 735kb

Going by the changelogs this seems to have been caused by adding increasingly complex parsers for first Markdown and then HTML?

I realize parsing these formats is complex but I do have to wonder if it's worth increasing the size of these packages by this much? To be completely honest 735kb feels genuinely like a bug for a package that's intended to be exposed client-side. Going by our bundle-analyzer this ends up making @storyblok/richtext a multitude times the size of react-dom.

Please reconsider the usage of these parsers. This doesn't feel like something that should be parsed client-side. Ideally this would be parsed within Storyblok's API itself so that only parsed data is exposed and these packages never have to deal with any of these concerns.

Alternatively consider making these parsers an optional configuration when initializing the Storyblok SDK and providing documentation on which options can and can not be used within Storyblok if these aren't provided so it's possible to skip these to keep a much more optimized bundle.

Steps to Reproduce

  1. Add the latest version of any Storyblok package
  2. Run a bundle analyzer

Expected Behavior

Storyblok's API provides a clean and parsed JSON format that never includes data that must be parsed client-side. The richtext package only contains rendering logic and is not responsible for parsing data.

Actual Behavior

The richtext package is responsible for dealing with any number of unvalidated and unstructured data formats that it must parse, including with a parser that's sufficiently advanced to account for all sorts of edge-cases.

Code Sample

Environment

Not related to a specific environment

Error Logs

Not related to specific error logs

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions