grafana avatar

Plugin Bundle Size

This walks you through systematically shrinking a Grafana app plugin's module.js from multi-megabyte bloat down to under 200 KB using React.lazy, Suspense, and webpack code splitting. The breakdown is unusually pragmatic: it gives you a risk matrix showing exactly what to split (routes, extensions) and what to leave alone (vendor libs, shared utils), plus a CI action that posts bundle diffs on every PR so you can see the impact immediately. The step-by-step goes from measurement to analysis to implementation in priority order, with real shell commands to measure production bundle size and grep for heavy imports. If your Grafana plugin is slow to load or you're staring at a 2 MB module.js, this is the playbook.

skills.sh installs
4.5K
GitHub stars
307
last updated
Aug 21, 2026

Install

$ npx -y skills add grafana/skills --skill plugin-bundle-size --agent claude-code

Installs into .claude/skills of the current project.

Files

Grafana plugin bundle size optimisation

module.js is the render-blocking entry point for every Grafana app plugin. The smaller it is, the less impact the plugin has on Grafana's overall startup time. A well-split plugin should have a module.js under ~200 KB that contains nothing but lazy-loaded wrappers — all feature code loads on demand.

Target: ~15–25 JS chunks total. Fewer means too little splitting; far more (50+) means over-engineering.

Risk levels

Not all splitting opportunities carry the same risk. Apply them in this order:

Sponsors

Details

Repository
github.com/grafana/skills
Categories
Frontend Development, Backend & APIs, Debugging
First seen
Jun 3, 2026

More from grafana/skills

All 42
1agricidaniel avatarads-creativeagricidaniel/claude-adsAudit paid-ad copy, images, video, hooks, concepts, format coverage, platform-native fit, message match, creative fatigue, accessibility, and policy across supp4.4Kskills.sh installs
2anthropics avatarsession-reportanthropics/claude-plugins-officialGenerate an explorable HTML report of Claude Code session usage (tokens, cache, subagents, skills, expensive prompts) from ~/.claude/projects transcripts.4.3Kskills.sh installs
3softaworks avatarc4-architecturesoftaworks/agent-toolkitGenerate architecture documentation using C4 model Mermaid diagrams. Use when asked to create architecture diagrams, document system architecture, visualize sof4.3Kskills.sh installs
4yaklang avatarandroid-pentesting-tricksyaklang/hack-skillsAndroid pentesting playbook. Use when testing Android applications for SSL pinning bypass, exported component abuse, WebView vulnerabilities, intent redirection4.3Kskills.sh installs
5giuseppe-trisciuoglio avatarturborepo-monorepogiuseppe-trisciuoglio/developer-kitProvides comprehensive Turborepo monorepo management guidance for TypeScript/JavaScript projects. Use when creating Turborepo workspaces, configuring turbo.json4.2Kskills.sh installs
6dpearson2699 avatarwidgetkitdpearson2699/swift-ios-skillsImplement, review, or improve WidgetKit widgets and controls. Use when building Home Screen, Lock Screen, StandBy, or CarPlay widgets with timeline providers; c4.2Kskills.sh installs