Replies: 7 comments 6 replies
-
Currently as it is, our packages satisfy the main requirement of tree-shakeability, which is that we are generating ESM javascript. However, our packages suffer from three problems that cause suboptimal tree-shakeability:
The biggest bang for the buck would be solving the problems in the order above. Other things worthy of mentioning:
|
Beta Was this translation helpful? Give feedback.
-
Cross-referencing with:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for your investigations so far. 🙏 Before deciding on a path forward, we should try assembling a table with:
The goal is to have a quick glance at the trade-off between Note
|
Beta Was this translation helpful? Give feedback.
-
Listing the dependencies that I remember off the top of my head (not a final list):
A lot of the issues related to tree-shakeability will be solved by fixing problematic dependencies. The packages that would most benefit from removing those dependencies are listed in #1461. We shouldn't spend time analyzing them until we solve the dependencies problem first because we won't know the state of our code properly until then. It's arduous to go through the generated code, and trying to analyze our own faults while lots of non-treeshakeable dependency code surrounds it just adds to the difficulty. |
Beta Was this translation helpful? Give feedback.
-
These two issues seem a bit overlapping. Can we merge them and have a final report to look at? |
Beta Was this translation helpful? Give feedback.
-
Also, it'd be good to have a clearer table with everything. Problematic dependencies
Problematic packages
|
Beta Was this translation helpful? Give feedback.
-
Problematic dependencies
An interesting thing to note is that some PRs are reducing the bundle size more than the reported effect of the corresponding library on the bundle size (e.g. #1594 reduces it by 19.86 kB but the table above reports its size to be 9.02 kB). I don't know the reason behind this and I don't think it's worth investigating. The main benefit of #1461 was reaped: we got a list of the most impactful libraries that we need to investigate/replace. If the removal of a library reduces the size even more - great! |
Beta Was this translation helpful? Give feedback.
-
From this comment:
For example, our
demo-react-vite
app has this import statement:import { BaseAssetId, encrypt, decrypt } from "fuels";
, but the impact on bundle size is +187kB, which is too much for such simple imports.Beta Was this translation helpful? Give feedback.
All reactions