Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lottie-web blows up our bundles and makes page load slower #3959

Closed
1 of 3 tasks
Mikadv opened this issue Dec 11, 2023 · 14 comments
Closed
1 of 3 tasks

lottie-web blows up our bundles and makes page load slower #3959

Mikadv opened this issue Dec 11, 2023 · 14 comments
Assignees

Comments

@Mikadv
Copy link

Mikadv commented Dec 11, 2023

What package(s) are you using?

  • Carbon for IBM Products (or Carbon for IBM Cloud & Cognitive)
  • Legacy/CDAI
  • Legacy/Security

Detailed description

On a performance improvement work across our offerings we noticed that there is a huge library in our chunks which is lottie-web. Its by far the biggest lib that gets pulled in and we wondered why, after investigation we noticed its from @carbon/ibm-products.

image

Now we wondered about two things:

  • Why is it nearly as big as our imports from @carbon/ibm-prodcuts? We didn't expect @carbon/ibm-prodcuts ships such a beast. More over we wondered if something is wrong here with tree shaking because it looks as if the entire library is pulled in instead of only the things it needs. Or in a nutshell: Treeshaking seems broken for it.
  • Why is it there at all? We use Tearsheet, TearsheetNarrow, TagSet, OptionsTile, UserProfileImage, ToolbarButton, ToolbarGroup, SidePanel. After discussions you use it for complex animations with SVG. But non of the above should have one. Or do I miss something here?

Describe in detail the issue you're having.

Our chunks get polluted and slow down page load because the browser has to download bigger bundles and analyze all of it before it can progress.

Is this issue related to a specific component?

Not sure.

What did you expect to happen? What happened instead? What would you like to
see changed?

  • The library is not there
  • If that is not an option: It gets tree-shaked and only relevant parts that @carbon/ibm-products use remain.

What browser are you working in?

Doesn't matter here.

What version of the @carbon/ibm-products (or @carbon/ibm-cloud-cognitive)
package are you using?

@carbon/ibm-products@^1.61.1

We use [email protected] at the state of writing with the default terser plugin that is shipped with it used.

Steps to reproduce the issue

  1. Include dependencies above.
  2. Compile your code, use the webpack-bundle-analyzer for it for instance
  3. Look for lottie
@paul-balchin-ibm
Copy link
Contributor

paul-balchin-ibm commented Dec 12, 2023

Hi @Mikadv,

  1. What are you using to generate your project? create-react-app, vite, next.js, something else?
  2. What version of React are you using?

@elycheea elycheea moved this from Needs triage 🧐 to In progress in Carbon for IBM Products Dec 12, 2023
@elycheea elycheea added the dependencies Pull requests that update a dependency file label Dec 12, 2023
@paul-balchin-ibm
Copy link
Contributor

Hi @Mikadv,

I created two basic projects, one using create-react-app and the other using vite.

  • Both installed React 18 by default and were rolled back to version 17
  • Both are referencing @carbon/ibm-products version 1.64.0

As you can see from the attached image, I was not able to replicate the problem you're experiencing.

InlineTip is the only component that imports SteppedAnimatedMedia,
SteppedAnimatedMedia is the only component in @carbon/ibm-products that imports lottie-web.

image

@elycheea elycheea added the version: 1 Carbon 10 / v1 label Jan 2, 2024
@elycheea elycheea moved this from In progress to Later 🏔️ in Carbon for IBM Products Jan 25, 2024
@Mikadv
Copy link
Author

Mikadv commented Feb 27, 2024

Thank you very much for checking. I double checked on our end. And I can see nothing in the call-chain where lottie-web would come with.

In the meantime I investigated more projects and their bundles and every time @carbon/ibm-products is part of it it bundles also lottie-web. Its like a curse that follows us. I also looked through the code and can't see something. It feels like we beat around the bushes and sadly miss an important part.

Copy link
Contributor

github-actions bot commented Apr 4, 2024

This issue is stale because it has been open for 30 days with no activity.
Remove the stale label or add a comment, otherwise this issue will be closed in 14 days.

Copy link
Contributor

This issue was closed because it has received no activity for 14 days.

@github-actions github-actions bot added the status: won’t fix 🔚 This will not be worked on label Apr 18, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2024
@github-project-automation github-project-automation bot moved this from Later 🏔️ to Done 🚀 in Carbon for IBM Products Apr 18, 2024
@asfordmatt
Copy link
Member

I'm seeing this too, the problem still exists

Copy link
Contributor

This issue is stale because it has been open for 7 days with no activity.
Remove the stale label or add a comment, otherwise this issue will be closed in 7 days.

@s100
Copy link
Contributor

s100 commented Sep 19, 2024

Bump, we also see this.

Copy link
Contributor

This issue is stale because it has been open for 7 days with no activity.
Remove the stale label or add a comment, otherwise this issue will be closed in 7 days.

@s100
Copy link
Contributor

s100 commented Sep 27, 2024

Bump.

Copy link
Contributor

github-actions bot commented Oct 7, 2024

This issue is stale because it has been open for 7 days with no activity.
Remove the stale label or add a comment, otherwise this issue will be closed in 7 days.

@s100
Copy link
Contributor

s100 commented Oct 8, 2024

Bump! This bot is dumb!

@elycheea
Copy link
Contributor

elycheea commented Oct 9, 2024

@s100 We’ll be closing this in favor of this new issue #6201 — in short, we’re going to try to remove the dependency entirely. 🤞

@elycheea elycheea closed this as completed Oct 9, 2024
@Mikadv
Copy link
Author

Mikadv commented Oct 10, 2024

🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

5 participants