Skip to content

Conversation

@oliverlaz
Copy link
Member

💡 Overview

With the introduction of the revamped video filters in #1977, our SDK grew by ~250KB after minification.
While filters are an optional feature, many bundlers were unnecessarily bundling them in the main app chunk, slightly increasing the JS download and parsing time.

With this PR, BackgroundFiltersProvider and the content of the @stream-io/video-filters-web package live in a separate, lazily loaded chunk of our SDK. This trick moves those ~250KB outside of the main bundle, hence restoring the previous performance and size constraints.

Implementation notes

Some code restructuring was necessary, so now we have:

  • types.ts - a shared module containing all types, used in both chunks
  • BackgroundFiltersProvider.tsx - code splitting happens here
  • BackgroundFilters.tsx - the original, slightly slimmed down implementation

@oliverlaz oliverlaz merged commit 21164f1 into main Dec 10, 2025
13 checks passed
@oliverlaz oliverlaz deleted the lazy-background-filters branch December 10, 2025 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants