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

Desktop: Reduce application size #11505

Merged

Conversation

personalizedrefrigerator
Copy link
Collaborator

Summary

This pull request is a follow-up to @pedr's work on decreasing the application build size.

This pull request moves mermaid from a runtime dependency to a dev dependency of the renderer package. This decreases the locally-built AppImage size from from 285.9 MB to 228.6 MB.

At present, mermaid is bundled into an asset file and only used from this asset file. As such, the mermaid package in node_modules is unused at runtime. This is the case on both mobile and desktop.

Testing plan

  1. Build an .AppImage using yarn dist.
  2. Start the .AppImage.
  3. Add a mermaid graph.
  4. Verify that the graph renders in the note viewer.
    • I tested with a gitGraph:
      screenshot: gitGraph rendered in the Markdown viewer and editor
  5. Switch to the Rich Text Editor and verify that the graph still renders.

The built AppImage decreases in size from 285.9 MB to 238 MB.
Not bundling the tests doesn't make a significant difference in app
size.
Comment on lines +21 to +22

"//": "Mermaid is bundled by buildAssets.js -- using it as an unbundled dependency significantly increases app size.",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about leaving comments in package.json with "//" (the suggestion in the upstream npm issue). Perhaps it would be better to document this somewhere else?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes i guess this is good enough. It's indeed tricky to document package.josn because of this limitation on comments

@personalizedrefrigerator personalizedrefrigerator changed the title Desktop: Reduce application build size Desktop: Reduce application size Dec 13, 2024
@personalizedrefrigerator personalizedrefrigerator added the desktop All desktop platforms label Dec 13, 2024
@laurent22 laurent22 merged commit 0a5bc96 into laurent22:dev Dec 13, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop All desktop platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants