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

[sparkle] Add minification on sparkle cjs code #10263

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tdraier
Copy link
Contributor

@tdraier tdraier commented Jan 28, 2025

Description

This is compressing the generated cjs for sparkle, which is used in next server-side and front-worker.
In the end it reduces by about 10Mb the memory footprint of sparkle. The problem is that the sources of all modules are loaded in memory by node for debugging purpose, and I did not find a way to disable this.

Note that sparkle.cjs is embedding all dependencies, and some are huge :

elkjs - 1.61 MB (14.48%)
mermaid - 1.51 MB (13.62%)
highlight.js - 1.37 MB (12.36%)
cytoscape - 954.15 kB (8.60%)
app - 654.04 kB (5.90%)
lottie-web - 627.79 kB (5.66%)
katex - 604.82 kB (5.45%)
@emoji-mart/data - 410.63 kB (3.70%)
parse5 - 275.85 kB (2.49%)
lodash-es - 184.47 kB (1.66%)
emoji-mart - 162.72 kB (1.47%)
@tanstack/table-core - 138.71 kB (1.25%)
dagre-d3-es - 119.51 kB (1.08%)
micromark-core-commonmark - 118.89 kB (1.07%)
layout-base - 117.75 kB (1.06%)

Most of them are probably not needed on server side anyway.

Tests

Risk

Minimal - we're just minifying and removing source maps.

Deploy Plan

publish sparkle, update front

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.

1 participant