-
Notifications
You must be signed in to change notification settings - Fork 22
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
Reduce Build Size #1528
Comments
I have some findings.
Minification is occurring. Vite uses
Now
This is also being done via the underlying Rollup bundle. I attempted to change the
I tried finding TLDR: We have minification and tree shaking in place already. The ways to enhance things I have found so far do not make a huge difference. Will do some more digging and post here if I find anything meaningful. |
Another thing we used to have (pre- Overall would be roughly the same amount downloaded, but you did get a faster startup (there has been a noticeable delay in page startup ever since we moved to Another thing to possibly explore. |
Looking at some stuff from @milespetrov build report. ag-gridWe're importing fabricSimilar for fabric, the I'm assuming this library is required to convert the SVG stuff to images without much hassle. If someone wants to look into using OffscreenCanvas as an alternative, could drop the entire lib. Would need to ensure the SVG stuff works good. esriThis is the biggest lib in the project. It is also the backbone lib (aside from Vue). That said, the modules appearing after "tree shaking" suggest the tree isn't shook very well. We import specific modules, so would expect things we are not using to be dropped. E.g. 250k for 3D support, 230k for Widgets, 440k for Arcade support (tho maybe we want this later), and who knows how many internal things. It even looks like there is a 1MB Worth looking into how our build prunes things not used? Maybe ESRI's internal build has references (i.e. you load a basic module and it pulls in other stuff JUST INCASE) and we're stuck. |
For ag-grid we certainly want to be targeting |
For ESRI, we're grabbing them from That said, everything gets pulled to |
I noticed a fairly recent change with vite/rollup that enables treeshaking for deterministic dynamic imports like:
Vite: vitejs/vite#11080 I don't think we have a lot of dynamic imports except for two places that use ramp4-pcar4/src/api/fixture.ts Line 10 in 016e214
ramp4-pcar4/src/api/panel-instance.ts Line 23 in 016e214
These modules would not be treeshaken. If possible update them with named imports and eager loading to make them deterministic, something like:
I'll also brain dump two things I read somewhere (can't find them now) before I forget:
|
We need the production map to determine where to focus our efforts. We should also proceed with testing out the dynamic imports. Experiment going back to umd build files. May improve loading times but won't help the build size. |
Investigate ways to reduce the size of the build. It is currently around 10MB. Part of this size difference (in comparison to RAMP2) is that we are bundling the ESRI API instead of having the app dynamically download it at startup.
The text was updated successfully, but these errors were encountered: