igniteui-blazor-compon…
Covers non-grid Ignite UI for Blazor UI components: application setup, form controls (inputs, combos, selects, date/time pickers,…
Optimize application bundle size by importing only necessary components and using tree-shaking effectively
$ npx -y skills add igniteui/igniteui-cli --skill igniteui-wc-optimize-bundle-size --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/igniteui-wc-optimize-bundle-sizeContext preview
The summary Claude sees to decide when to auto-load this skill.
Optimize application bundle size by importing only necessary components and using tree-shaking effectively
name: igniteui-wc-optimize-bundle-size description: Optimize application bundle size by importing only necessary components and using tree-shaking effectively user-invocable: true
This skill helps users minimize their application's bundle size when using Ignite UI Web Components by importing only the components they need and following best practices for tree-shaking.
1. **Import only what you use** - Don't use `defineAllComponents()` 2. **Use named imports** - Enable tree-shaking 3. **Analyze your bundle** - Identify what's being included 4. **Lazy load when possible** - Load components on demand
// DON'T DO THIS - imports ALL components (~500KB+)
import { defineAllComponents } from 'igniteui-webcomponents';
defineAllComponents();**Impact:** Includes all 60+ components whether you use them or not.
// DO THIS - import only what you need
import {
defineComponents,
IgcButtonComponent,
IgcInputComponent,
IgcCardComponent
} from 'igniteui-webcomponents';
defineComponents(IgcButtonComponent, IgcInputComponent, IgcCardComponent);**Impact:** Bundle includes only 3 components and their dependencies.
If you're using React, consider using the **`igniteui-react`** package instead of `igniteui-webcomponents`. It provides the same components with React-friendly wrappers and typically results in better tree-shaking:
npm install igniteui-react
import { IgrButton, IgrInput, IgrCard } from 'igniteui-react';
// No need to call defineComponents - components register automatically
function MyComponent() {
return (
<div>
<IgrButton variant="contained">Click me</IgrButton>
<IgrInput label="Name" />
<IgrCard>Content</IgrCard>
</div>
);
}**Benefits for bundle size:**
For more details, see the [igniteui-wc-integrate-with-framework](../igniteui-wc-integrate-with-framework/SKILL.md) skill.
**Installation:**
npm install --save-dev webpack-bundle-analyzer
**Configuration (`webpack.config.js`):**
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
module.exports = {
plugins: [
new BundleAnalyzerPlugin({
analyzerMode: 'static',
openAnalyzer: false,
reportFilename: 'bundle-report.html'
})
]
};**Run analysis:**
npm run build # Open bundle-report.html to see what's included
**Installation:**
npm install --save-dev rollup-plugin-visualizer
**Configuration (`vite.config.ts`):**
import { defineConfig } from 'vite';
import { visualizer } from 'rollup-plugin-visualizer';
export default defineConfig({
plugins: [
visualizer({
open: true,
gzipSize: true,
brotliSize: true,
})
]
});**Run analysis:**
npm run build # Opens stats.html automatically
**Installation:**
npm install --save-dev source-map-explorer
**Package.json:**
{
"scripts": {
"analyze": "source-map-explorer 'dist/**/*.js'"
}
}**Run:**
npm run build npm run analyze
Search your codebase for component usage:
# Search for component tags in templates grep -r "igc-" src/ --include="*.html" --include="*.tsx" --include="*.vue" # List unique components grep -roh "igc-[a-z-]*" src/ | sort | uniq
Check what you're importing vs what you're using:
// Find in your code
import {
defineComponents,
IgcButtonComponent,
IgcInputComponent,
IgcCardComponent,
IgcSelectComponent, // ← Are you using this?
IgcComboComponent, // ← Are you using this?
} from 'igniteui-webcomponents';Remove components you're not using:
// Before: 5 components imported
import {
defineComponents,
IgcButtonComponent,
IgcInputComponent,
IgcCardComponent,
IgcSelectComponent,
IgcComboComponent,
} from 'igniteui-webcomponents';
defineComponents(
IgcButtonComponent,
IgcInputComponent,
IgcCardComponent,
IgcSelectComponent,
IgcComboComponent
);
// After: Only 3 components needed
import {
defineComponents,
IgcButtonComponent,
IgcInputComponent,
IgcCardComponent,
} from 'igniteui-webcomponents';
defineComponents(IgcButtonComponent, IgcInputComponent, IgcCardComponent);Load components only when needed to reduce initial bundle size.
// Load immediately (increases initial bundle)
import { defineComponents, IgcDialogComponent } from 'igniteui-webcomponents';
defineComponents(IgcDialogComponent);
// Lazy load (smaller initial bundle)
async function showDialog() {
const { defineComponents, IgcDialogComponent } = await import('igniteui-webcomponents')Covers non-grid Ignite UI for Blazor UI components: application setup, form controls (inputs, combos, selects, date/time pickers,…
Implement Blazor application views from design images using Ignite UI Blazor components. Uses MCP servers (igniteui-cli,…
Provides guidance on all Ignite UI for Blazor data grid types (Grid Lite, Flat Grid, Tree Grid, Hierarchical Grid, Pivot Grid)…
Covers theming and visual customization for Ignite UI for Blazor: choosing and switching built-in themes (Bootstrap, Material,…
This skill identifies the right Ignite UI for React components for any UI pattern and covers installing, importing, and using…
This skill customizes Ignite UI for React component styling using CSS custom properties and the full theming system and should be…