Reduce the bundle size of the Content Editor
Summary
The Content Editor bundle size is growing fast as we implement more features that require adding new dependencies. Currently, the Content Editor parsed size is 1.35mb and gzipped is 430.69kb.
The biggest contributor to bundle size in the Content Editor is the code block highlight extension. This extension requires loading all highlight.js
languages on demand. The sum of all this language definitions has a parsed size of 807kb/266kbgzipped.
The 2nd contributor to bundle size is the Markdown Serializer that adds ~350kb/100kb gzipped. This is not a reality yet, however, once we merge the solution to preserve unmodified source, it will be.
Involved components
- The code block highlight extension
- The Markdown Serializer.
Improvements
We need to load these components of the asynchronously. For example, the Markdown Serializer is not necessary until the user saves changes. We could also re-implement the code block extension to either use the Source Editor which is preloaded or load highlight.js languages on demand.
Risks
We need to solve this problem before the Content Editor is adopted in other features. This bundle size could significantly affect the load speed of the issue, snippets viewer, and merge request pages. It could also jeopardize our effort of providing inline editing in the Wikis