mirror of
https://github.com/open-webui/open-webui.git
synced 2026-06-05 00:10:27 -05:00
[PR #22304] [MERGED] perf(frontend): lazy-load shiki to remove ~5-10MB from initial bundle #130259
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/22304
Author: @Classic298
Created: 3/6/2026
Status: ✅ Merged
Merged: 3/6/2026
Merged by: @tjbck
Base:
dev← Head:perf/lazy-shiki📝 Commits (1)
de3b43eperf(frontend): lazy-load shiki to remove ~5-10MB from initial bundle📊 Changes
1 file changed (+99 additions, -5 deletions)
View changed files
📝
src/lib/utils/codeHighlight.ts(+99 -5)📄 Description
codeHighlight.ts had a top-level static import of shiki that pulled the entire highlighter engine (~5-10MB of JavaScript including all language grammars) into any page that imported the module - even if only the lightweight isCodeFile() function was used.
Replace the static shiki import with:
The static language set covers all commonly-used file extensions. Obscure extensions not in the set simply won't be detected by isCodeFile() (the file still opens fine, just won't show the code file indicator). Highlighting itself still works for all shiki languages since the full bundle loads on demand.
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.