igniteui-cli 15.5.0 → 15.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/templates/blazor/igb/projects/ai-config/files/skills/AGENTS.md +6 -3
- package/templates/blazor/igb/projects/ai-config/files/skills/README.md +30 -45
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/SKILL.md +48 -96
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/charts.md +61 -238
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/data-display.md +60 -193
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/feedback.md +36 -92
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/form-controls.md +66 -224
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/layout-manager.md +39 -88
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/layout.md +75 -152
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/setup.md +40 -149
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-generate-from-image-design/SKILL.md +58 -243
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-generate-from-image-design/references/component-mapping.md +89 -280
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-generate-from-image-design/references/gotchas.md +143 -431
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/SKILL.md +91 -157
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/data-operations.md +50 -228
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/editing.md +61 -222
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/features.md +67 -360
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/grid-migration.md +55 -236
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/paging-remote.md +53 -202
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/sizing.md +31 -232
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/state.md +27 -119
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/structure.md +88 -363
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/types.md +87 -415
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-lite-testing/SKILL.md +86 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-lite-testing/references/interop-contracts.md +220 -0
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/SKILL.md +83 -211
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/references/common-patterns.md +93 -184
- package/templates/react/igr-ts/projects/_base/files/src/main.tsx +1 -0
- package/templates/react/igr-ts/projects/_base_with_home/files/src/app/home/style.module.css +3 -3
- package/templates/react/igr-ts/projects/ai-config/files/skills/README.md +30 -83
- package/templates/react/igr-ts/projects/ai-config/files/skills/grid-lite-to-igr-grid-migration/SKILL.md +98 -191
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/SKILL.md +38 -147
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/COMPONENTS.md +65 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/DATAVIZ.md +90 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/MCP.md +43 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/TROUBLESHOOTING.md +17 -145
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/USAGE.md +85 -0
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/SKILL.md +83 -135
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/reference/CSS-THEMING.md +51 -218
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-generate-from-image-design/SKILL.md +58 -187
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-generate-from-image-design/reference/gotchas.md +55 -154
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-optimize-bundle-size/SKILL.md +48 -401
- package/templates/react/igr-ts/projects/side-nav/files/src/app/app.css +9 -9
- package/templates/react/igr-ts/projects/side-nav/files/src/app/home/style.module.css +7 -7
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/app.css +8 -8
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/Login.module.css +1 -69
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/Login.tsx +5 -5
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/LoginBar.module.css +5 -26
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/LoginDialog.module.css +0 -1
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/Register.module.css +1 -56
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/components/Register.tsx +2 -2
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/pages/Profile.module.css +11 -11
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/pages/RedirectFacebook.tsx +1 -1
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/pages/RedirectGoogle.tsx +1 -1
- package/templates/react/igr-ts/projects/side-nav-auth/files/src/app/authentication/pages/RedirectMicrosoft.tsx +1 -1
- package/templates/react/igr-ts/projects/side-nav-mini/files/src/app/app.css +9 -9
- package/templates/react/igr-ts/projects/side-nav-mini/files/src/app/home/style.module.css +7 -7
- package/templates/react/igr-ts/projects/side-nav-mini-auth/files/src/app/app.css +7 -7
- package/templates/webcomponents/igc-ts/constants.d.ts +5 -5
- package/templates/webcomponents/igc-ts/constants.js +5 -5
- package/templates/webcomponents/igc-ts/projects/_base/files/package.json +1 -1
- package/templates/webcomponents/igc-ts/projects/_base_with_home/files/package.json +6 -6
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-components/references/mcp-setup.md +0 -78
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-grids/references/mcp-setup.md +0 -78
- package/templates/blazor/igb/projects/ai-config/files/skills/igniteui-blazor-theming/references/mcp-setup.md +0 -81
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/CHARTS-GRIDS.md +0 -398
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/COMPONENT-CATALOGUE.md +0 -161
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/EVENT-HANDLING.md +0 -72
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/INSTALLATION.md +0 -139
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/JSX-PATTERNS.md +0 -187
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/MCP-SERVER.md +0 -77
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-components/reference/REFS-FORMS.md +0 -232
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/reference/MCP-SERVER.md +0 -67
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-customize-theme/reference/TROUBLESHOOTING.md +0 -35
- package/templates/react/igr-ts/projects/ai-config/files/skills/igniteui-react-generate-from-image-design/reference/component-mapping.md +0 -132
|
@@ -1,439 +1,86 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: igniteui-react-optimize-bundle-size
|
|
3
|
-
description:
|
|
3
|
+
description: Reduce bundle size in apps using Ignite UI for React — package selection, tree-shaking, and route-level code splitting of grids, charts, maps, and gauges. Use when the bundle or initial load is too large, when tree-shaking is not eliminating unused Ignite UI code, or when deciding what to lazy load.
|
|
4
4
|
user-invocable: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# Optimizing Ignite UI for React Bundle Size
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Standard React techniques (`React.lazy` + `Suspense`, route splitting, minification, compression, bundle analyzers) apply unchanged. This skill covers only what is specific to Ignite UI.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Where the weight is
|
|
12
12
|
|
|
13
|
-
- "
|
|
14
|
-
- "How do I reduce the size of igniteui-react?"
|
|
15
|
-
- "Import only the components I need"
|
|
16
|
-
- "Tree-shake unused components"
|
|
17
|
-
- "Optimize imports for production"
|
|
18
|
-
- "How do I lazy load the data grid?"
|
|
13
|
+
`igniteui-react` is published with `"sideEffects": false` and per-component modules, so named imports tree-shake well — a handful of core components costs little. The heavy families are separate packages:
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- [igniteui-react-components](../igniteui-react-components/SKILL.md) — Choose only the components you need and set up your React project
|
|
23
|
-
- [igniteui-react-customize-theme](../igniteui-react-customize-theme/SKILL.md) — Theming after optimization
|
|
24
|
-
|
|
25
|
-
## When to Use
|
|
26
|
-
|
|
27
|
-
- Application bundle size is too large
|
|
28
|
-
- User wants to optimize for production
|
|
29
|
-
- User is importing more components than needed
|
|
30
|
-
- User asks about tree-shaking or optimization
|
|
31
|
-
- User wants to improve load times
|
|
32
|
-
- User wants to code-split heavy components like grids or charts
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Key Principles
|
|
37
|
-
|
|
38
|
-
1. **Install only the packages you need** — don't install `igniteui-react-grids` if you only use core UI components
|
|
39
|
-
2. **Use named imports** — enable tree-shaking by importing specific components
|
|
40
|
-
3. **Lazy load heavy components** — use `React.lazy` + `Suspense` for grids, charts, and other large components
|
|
41
|
-
4. **Analyze your bundle** — use tools to identify what's being included
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## Granular Package Imports
|
|
46
|
-
|
|
47
|
-
Only install the packages you actually use:
|
|
48
|
-
|
|
49
|
-
| Package | Contains | Install only if you need… |
|
|
15
|
+
| Package | Weight | Notes |
|
|
50
16
|
|---|---|---|
|
|
51
|
-
| `igniteui-react` |
|
|
52
|
-
| `igniteui-
|
|
53
|
-
| `igniteui-react-grids` |
|
|
54
|
-
| `igniteui-react-charts`
|
|
55
|
-
| `igniteui-react-maps` | Geographic maps | Map visualizations (commercial) |
|
|
56
|
-
| `igniteui-react-gauges` | Radial and linear gauges | Gauge indicators (commercial) |
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
# Only install what you need:
|
|
60
|
-
npm install igniteui-react # Core UI only
|
|
61
|
-
npm install igniteui-react-grids # Only if you need advanced grids
|
|
62
|
-
npm install igniteui-react-charts # Only if you need charts
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## Import Strategies
|
|
68
|
-
|
|
69
|
-
### ❌ Bad: Wildcard / Barrel Imports
|
|
70
|
-
|
|
71
|
-
```tsx
|
|
72
|
-
// DON'T DO THIS — imports everything from the package
|
|
73
|
-
import * as IgniteUI from 'igniteui-react';
|
|
74
|
-
|
|
75
|
-
function App() {
|
|
76
|
-
return <IgniteUI.IgrButton>Click</IgniteUI.IgrButton>;
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
**Impact:** Tree-shaking cannot eliminate unused components.
|
|
81
|
-
|
|
82
|
-
### ✅ Good: Named Imports
|
|
83
|
-
|
|
84
|
-
```tsx
|
|
85
|
-
// DO THIS — import only what you use
|
|
86
|
-
import { IgrButton, IgrInput, IgrCard } from 'igniteui-react';
|
|
87
|
-
|
|
88
|
-
function App() {
|
|
89
|
-
return (
|
|
90
|
-
<div>
|
|
91
|
-
<IgrInput label="Name" />
|
|
92
|
-
<IgrButton><span>Submit</span></IgrButton>
|
|
93
|
-
<IgrCard>Content</IgrCard>
|
|
94
|
-
</div>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Impact:** Bundle includes only the three components and their dependencies. Tree-shaking removes everything else.
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## Lazy Loading with `React.lazy` + `Suspense`
|
|
17
|
+
| `igniteui-react` | light per component | core UI; tree-shakes cleanly |
|
|
18
|
+
| `igniteui-grid-lite` | small | MIT grid; far lighter than the premium grids |
|
|
19
|
+
| `igniteui-react-grids` | heavy | Data/Tree/Pivot/Hierarchical grid |
|
|
20
|
+
| `igniteui-react-charts` / `-maps` / `-gauges` | heavy | legacy DV packages, weaker tree-shaking |
|
|
104
21
|
|
|
105
|
-
|
|
22
|
+
Two conclusions: **install only the families you use**, and **split the heavy families out of the initial chunk**. Downgrading `IgrGrid` to `IgrGridLite` is often the single largest win when the app only displays flat, read-only data — check the feature list in [DATAVIZ.md](../igniteui-react-components/reference/DATAVIZ.md) first.
|
|
106
23
|
|
|
107
|
-
|
|
24
|
+
## Import rules
|
|
108
25
|
|
|
109
26
|
```tsx
|
|
110
|
-
import {
|
|
111
|
-
|
|
112
|
-
//
|
|
113
|
-
const IgrDialog = lazy(() =>
|
|
114
|
-
import('igniteui-react').then(module => ({ default: module.IgrDialog }))
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
function App() {
|
|
118
|
-
const [showDialog, setShowDialog] = useState(false);
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<>
|
|
122
|
-
<button onClick={() => setShowDialog(true)}>Open Dialog</button>
|
|
123
|
-
{showDialog && (
|
|
124
|
-
<Suspense fallback={<div>Loading...</div>}>
|
|
125
|
-
<IgrDialog open title="Hello">
|
|
126
|
-
<p>Lazy loaded dialog content</p>
|
|
127
|
-
</IgrDialog>
|
|
128
|
-
</Suspense>
|
|
129
|
-
)}
|
|
130
|
-
</>
|
|
131
|
-
);
|
|
132
|
-
}
|
|
27
|
+
import { IgrButton, IgrCard } from 'igniteui-react'; // ✅ tree-shakes
|
|
28
|
+
import * as IgniteUI from 'igniteui-react'; // ❌ defeats tree-shaking
|
|
29
|
+
import { IgcButtonComponent } from 'igniteui-webcomponents'; // ❌ bypasses the wrapper
|
|
133
30
|
```
|
|
134
31
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
This is the recommended approach for code-splitting: wrap entire page components that use heavy Ignite UI components.
|
|
32
|
+
Never import from `igniteui-webcomponents` (or `igniteui-webcomponents-grids`) directly. It pulls a second copy of the element definitions alongside the wrappers and skips the auto-registration the wrapper performs.
|
|
138
33
|
|
|
139
|
-
|
|
140
|
-
// App.tsx
|
|
141
|
-
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
142
|
-
import { lazy, Suspense } from 'react';
|
|
34
|
+
## Splitting the heavy families
|
|
143
35
|
|
|
144
|
-
|
|
145
|
-
const DashboardPage = lazy(() => import('./pages/Dashboard'));
|
|
146
|
-
const AnalyticsPage = lazy(() => import('./pages/Analytics'));
|
|
147
|
-
|
|
148
|
-
function App() {
|
|
149
|
-
return (
|
|
150
|
-
<BrowserRouter>
|
|
151
|
-
<Suspense fallback={<div>Loading...</div>}>
|
|
152
|
-
<Routes>
|
|
153
|
-
<Route path="/" element={<HomePage />} />
|
|
154
|
-
<Route path="/dashboard" element={<DashboardPage />} />
|
|
155
|
-
<Route path="/analytics" element={<AnalyticsPage />} />
|
|
156
|
-
</Routes>
|
|
157
|
-
</Suspense>
|
|
158
|
-
</BrowserRouter>
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
```
|
|
36
|
+
Lazy-load at the **route or panel** boundary, not the component. `IgrGrid` and the DV charts are only worth splitting when the whole view that uses them is deferred.
|
|
162
37
|
|
|
163
38
|
```tsx
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
import 'igniteui-react-grids/grids/themes/light/bootstrap.css';
|
|
167
|
-
|
|
168
|
-
export default function Dashboard() {
|
|
169
|
-
return (
|
|
170
|
-
<IgrGrid data={data} autoGenerate={false}>
|
|
171
|
-
<IgrColumn field="name" header="Name" />
|
|
172
|
-
<IgrColumn field="value" header="Value" />
|
|
173
|
-
</IgrGrid>
|
|
174
|
-
);
|
|
175
|
-
}
|
|
39
|
+
const Dashboard = lazy(() => import('./pages/Dashboard')); // grid + its theme CSS
|
|
40
|
+
const Analytics = lazy(() => import('./pages/Analytics')); // charts + registration
|
|
176
41
|
```
|
|
177
42
|
|
|
178
|
-
|
|
179
|
-
// pages/Analytics.tsx — only loaded when navigating to /analytics
|
|
180
|
-
import { IgrCategoryChart, IgrCategoryChartModule } from 'igniteui-react-charts';
|
|
181
|
-
|
|
182
|
-
IgrCategoryChartModule.register();
|
|
43
|
+
Two Ignite-UI-specific details:
|
|
183
44
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
```
|
|
45
|
+
- **Keep the grid theme CSS import inside the lazy chunk** (`import 'igniteui-react-grids/grids/themes/light/bootstrap.css'` in `Dashboard.tsx`), so the grid stylesheet is not in the initial payload. The base theme CSS stays in the entry point — every page needs it.
|
|
46
|
+
- **Keep `.register()` calls inside the lazy chunk too.** Chart, gauge, and map modules must register at module scope of the file that uses them; hoisting the registration to the entry point pulls the whole DV package back into the initial bundle.
|
|
188
47
|
|
|
189
|
-
|
|
48
|
+
For manual chunking, give each family its own chunk so a page needing charts does not download grids:
|
|
190
49
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
## Analyzing Your Bundle
|
|
194
|
-
|
|
195
|
-
### Using Vite's Rollup Visualizer
|
|
196
|
-
|
|
197
|
-
```bash
|
|
198
|
-
npm install --save-dev rollup-plugin-visualizer
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
```typescript
|
|
50
|
+
```ts
|
|
202
51
|
// vite.config.ts
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
open: true,
|
|
212
|
-
gzipSize: true,
|
|
213
|
-
brotliSize: true,
|
|
214
|
-
})
|
|
215
|
-
]
|
|
216
|
-
});
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
npm run build
|
|
221
|
-
# Opens stats.html automatically — inspect which igniteui-react modules are included
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### Using Webpack Bundle Analyzer
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
npm install --save-dev webpack-bundle-analyzer
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
```javascript
|
|
231
|
-
// webpack.config.js (or CRA with react-app-rewired)
|
|
232
|
-
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
233
|
-
|
|
234
|
-
module.exports = {
|
|
235
|
-
plugins: [
|
|
236
|
-
new BundleAnalyzerPlugin({
|
|
237
|
-
analyzerMode: 'static',
|
|
238
|
-
openAnalyzer: false,
|
|
239
|
-
reportFilename: 'bundle-report.html'
|
|
240
|
-
})
|
|
241
|
-
]
|
|
242
|
-
};
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Using source-map-explorer
|
|
246
|
-
|
|
247
|
-
```bash
|
|
248
|
-
npm install --save-dev source-map-explorer
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
```json
|
|
252
|
-
{
|
|
253
|
-
"scripts": {
|
|
254
|
-
"analyze": "source-map-explorer 'dist/**/*.js'"
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
npm run build
|
|
261
|
-
npm run analyze
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
**What to look for:** Check if `igniteui-react-grids` or `igniteui-react-charts` appear in the initial bundle even though they're only used on specific routes.
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
## Audit Your Component Usage
|
|
269
|
-
|
|
270
|
-
### 1. Find What Components You're Actually Using
|
|
271
|
-
|
|
272
|
-
```bash
|
|
273
|
-
# Search for Igr component usage in your source files
|
|
274
|
-
grep -roh "Igr[A-Z][a-zA-Z]*" src/ --include="*.tsx" --include="*.ts" | sort | uniq
|
|
275
|
-
|
|
276
|
-
# Example output:
|
|
277
|
-
# IgrButton
|
|
278
|
-
# IgrCard
|
|
279
|
-
# IgrInput
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### 2. Compare with Your Imports
|
|
283
|
-
|
|
284
|
-
```bash
|
|
285
|
-
# Find all import statements from igniteui-react packages
|
|
286
|
-
grep -r "from 'igniteui-react" src/ --include="*.tsx" --include="*.ts"
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
### 3. Remove Unused Imports
|
|
290
|
-
|
|
291
|
-
```tsx
|
|
292
|
-
// Before: 5 components imported
|
|
293
|
-
import { IgrButton, IgrInput, IgrCard, IgrSelect, IgrCombo } from 'igniteui-react';
|
|
294
|
-
|
|
295
|
-
// After audit: only 3 are actually used in JSX
|
|
296
|
-
import { IgrButton, IgrInput, IgrCard } from 'igniteui-react';
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
---
|
|
300
|
-
|
|
301
|
-
## Build Configuration Optimizations
|
|
302
|
-
|
|
303
|
-
### Vite Configuration
|
|
304
|
-
|
|
305
|
-
```typescript
|
|
306
|
-
// vite.config.ts
|
|
307
|
-
import { defineConfig } from 'vite';
|
|
308
|
-
import react from '@vitejs/plugin-react';
|
|
309
|
-
|
|
310
|
-
export default defineConfig({
|
|
311
|
-
plugins: [react()],
|
|
312
|
-
build: {
|
|
313
|
-
minify: 'terser',
|
|
314
|
-
terserOptions: {
|
|
315
|
-
compress: {
|
|
316
|
-
drop_console: true,
|
|
317
|
-
drop_debugger: true
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
rollupOptions: {
|
|
321
|
-
output: {
|
|
322
|
-
manualChunks: {
|
|
323
|
-
'igniteui-core': ['igniteui-react'],
|
|
324
|
-
// Only include if you use these packages:
|
|
325
|
-
// 'igniteui-grids': ['igniteui-react-grids'],
|
|
326
|
-
// 'igniteui-charts': ['igniteui-react-charts'],
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
chunkSizeWarningLimit: 600,
|
|
331
|
-
},
|
|
332
|
-
optimizeDeps: {
|
|
333
|
-
include: ['igniteui-react']
|
|
334
|
-
}
|
|
335
|
-
});
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
### Webpack Configuration
|
|
339
|
-
|
|
340
|
-
```javascript
|
|
341
|
-
// webpack.config.js
|
|
342
|
-
module.exports = {
|
|
343
|
-
optimization: {
|
|
344
|
-
splitChunks: {
|
|
345
|
-
chunks: 'all',
|
|
346
|
-
cacheGroups: {
|
|
347
|
-
igniteui: {
|
|
348
|
-
test: /[\\/]node_modules[\\/]igniteui-react[\\/]/,
|
|
349
|
-
name: 'igniteui',
|
|
350
|
-
priority: 20,
|
|
351
|
-
},
|
|
352
|
-
igniteuiGrids: {
|
|
353
|
-
test: /[\\/]node_modules[\\/]igniteui-react-grids[\\/]/,
|
|
354
|
-
name: 'igniteui-grids',
|
|
355
|
-
priority: 20,
|
|
356
|
-
}
|
|
357
|
-
}
|
|
52
|
+
build: {
|
|
53
|
+
rollupOptions: {
|
|
54
|
+
output: {
|
|
55
|
+
manualChunks: {
|
|
56
|
+
'ig-core': ['igniteui-react'],
|
|
57
|
+
'ig-grids': ['igniteui-react-grids'], // only if actually installed
|
|
58
|
+
'ig-charts': ['igniteui-react-charts'], // only if actually installed
|
|
59
|
+
},
|
|
358
60
|
},
|
|
359
|
-
minimize: true,
|
|
360
61
|
},
|
|
361
|
-
mode: 'production',
|
|
362
|
-
};
|
|
363
|
-
```
|
|
364
|
-
|
|
365
|
-
---
|
|
366
|
-
|
|
367
|
-
## Best Practices Checklist
|
|
368
|
-
|
|
369
|
-
- [ ] **Install only the packages you need** — don't install `igniteui-react-grids` if you only use buttons and inputs
|
|
370
|
-
- [ ] **Use named imports** — `import { IgrButton } from 'igniteui-react'`, not `import * as`
|
|
371
|
-
- [ ] **Don't import from `igniteui-webcomponents` directly** — use the `igniteui-react` wrappers
|
|
372
|
-
- [ ] **Lazy load heavy components** — use `React.lazy` + `Suspense` for grids, charts, and dialogs
|
|
373
|
-
- [ ] **Split by routes** — load component-heavy pages only when navigated to
|
|
374
|
-
- [ ] **Audit your imports regularly** — remove unused components
|
|
375
|
-
- [ ] **Analyze your bundle** — use bundle analyzer tools to verify tree-shaking is working
|
|
376
|
-
- [ ] **Minify in production** — ensure build tool minification is enabled
|
|
377
|
-
- [ ] **Use compression** — enable gzip/brotli on your server
|
|
378
|
-
|
|
379
|
-
---
|
|
380
|
-
|
|
381
|
-
## Common Issues & Solutions
|
|
382
|
-
|
|
383
|
-
### Issue: Bundle still large after using named imports
|
|
384
|
-
|
|
385
|
-
**Investigate:**
|
|
386
|
-
1. Check if you're importing from `igniteui-webcomponents` instead of `igniteui-react`
|
|
387
|
-
2. Verify tree-shaking is working (check build output with a bundle analyzer)
|
|
388
|
-
3. Look for barrel imports (`import * as`)
|
|
389
|
-
4. Check if large packages like `igniteui-react-grids` are in the initial bundle instead of being lazy loaded
|
|
390
|
-
|
|
391
|
-
### Issue: Lazy loaded component flashes or shows fallback too long
|
|
392
|
-
|
|
393
|
-
**Solution:** Preload the component on hover or route prefetch:
|
|
394
|
-
|
|
395
|
-
```tsx
|
|
396
|
-
const DashboardPage = lazy(() => import('./pages/Dashboard'));
|
|
397
|
-
|
|
398
|
-
// Preload on hover
|
|
399
|
-
function NavLink() {
|
|
400
|
-
const preload = () => { import('./pages/Dashboard'); };
|
|
401
|
-
return <a href="/dashboard" onMouseEnter={preload}>Dashboard</a>;
|
|
402
62
|
}
|
|
403
63
|
```
|
|
404
64
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
**Cause:** Using `require()` instead of `import`, or a build tool that doesn't support ES module tree-shaking.
|
|
408
|
-
|
|
409
|
-
**Solution:** Ensure your project uses ES modules:
|
|
65
|
+
## Auditing
|
|
410
66
|
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
"moduleResolution": "bundler"
|
|
417
|
-
}
|
|
418
|
-
}
|
|
67
|
+
```bash
|
|
68
|
+
# components referenced in JSX
|
|
69
|
+
grep -rhoE "<Igr[A-Za-z]+" src --include="*.tsx" | sort -u
|
|
70
|
+
# what is imported
|
|
71
|
+
grep -rn "from 'igniteui-react" src --include="*.tsx" --include="*.ts"
|
|
419
72
|
```
|
|
420
73
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
## Expected Results
|
|
74
|
+
Then run any bundle analyzer and check the initial chunk for `igniteui-react-grids` / `-charts`. If either appears there while only used on secondary routes, the split is not working — usually a shared module (a barrel `index.ts`, a types file, or a hoisted `.register()` call) re-imports it eagerly.
|
|
424
75
|
|
|
425
|
-
|
|
76
|
+
## When tree-shaking still fails
|
|
426
77
|
|
|
427
|
-
|
|
428
|
-
-
|
|
429
|
-
|
|
430
|
-
-
|
|
431
|
-
- **Lower bandwidth usage** for users
|
|
78
|
+
1. A wildcard or barrel import somewhere in `src`.
|
|
79
|
+
2. A local barrel file re-exporting Ignite UI components — it creates one module that depends on everything.
|
|
80
|
+
3. CommonJS output: set `"module": "esnext"` and `"moduleResolution": "bundler"` in `tsconfig.json`.
|
|
81
|
+
4. Both `igniteui-react-grids` and `@infragistics/igniteui-react-grids` resolved at once — pick one scope.
|
|
432
82
|
|
|
433
|
-
##
|
|
83
|
+
## Related skills
|
|
434
84
|
|
|
435
|
-
- [
|
|
436
|
-
- [
|
|
437
|
-
- [Webpack Tree Shaking](https://webpack.js.org/guides/tree-shaking/)
|
|
438
|
-
- [Web Performance Optimization](https://web.dev/fast/)
|
|
439
|
-
- [Bundle Size Analysis Tools](https://bundlephobia.com/)
|
|
85
|
+
- [igniteui-react-components](../igniteui-react-components/SKILL.md) — package routing and what each family provides
|
|
86
|
+
- [grid-lite-to-igr-grid-migration](../grid-lite-to-igr-grid-migration/SKILL.md) — the reverse direction, when Grid Lite is not enough
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
flex: 0 0 auto;
|
|
12
12
|
height: 56px;
|
|
13
13
|
padding: 0 16px;
|
|
14
|
-
background:
|
|
15
|
-
box-shadow:
|
|
14
|
+
background: var(--ig-primary-500);
|
|
15
|
+
box-shadow: var(--ig-elevation-4);
|
|
16
16
|
box-sizing: border-box;
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
font-size: 1.25rem;
|
|
22
22
|
font-weight: 600;
|
|
23
23
|
line-height: 1;
|
|
24
|
-
color:
|
|
24
|
+
color: var(--ig-primary-500-contrast);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
.app__menu-button {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
width: 40px;
|
|
32
32
|
height: 40px;
|
|
33
33
|
padding: 0;
|
|
34
|
-
color:
|
|
34
|
+
color: var(--ig-primary-500-contrast);
|
|
35
35
|
border: 0;
|
|
36
36
|
background: transparent;
|
|
37
37
|
cursor: pointer;
|
|
@@ -55,20 +55,20 @@
|
|
|
55
55
|
|
|
56
56
|
igc-nav-drawer-item::part(base) {
|
|
57
57
|
min-height: 48px;
|
|
58
|
-
color:
|
|
58
|
+
color: var(--ig-gray-900);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
igc-nav-drawer-item[active]::part(base) {
|
|
62
|
-
background:
|
|
63
|
-
color:
|
|
62
|
+
background: var(--ig-primary-100);
|
|
63
|
+
color: var(--ig-primary-500);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
igc-nav-drawer-item[active] igc-icon {
|
|
67
|
-
color:
|
|
67
|
+
color: var(--ig-primary-500);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
igc-nav-drawer-item:not([active]) igc-icon {
|
|
71
|
-
color:
|
|
71
|
+
color: var(--ig-gray-900);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.app__content {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
margin: auto;
|
|
5
5
|
padding: 48px 24px;
|
|
6
6
|
box-sizing: border-box;
|
|
7
|
-
font-family:
|
|
7
|
+
font-family: var(--ig-font-family);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
:local(.intro) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
:local(.header) {
|
|
17
17
|
margin: 0 0 12px;
|
|
18
|
-
color:
|
|
18
|
+
color: var(--ig-primary-500);
|
|
19
19
|
font-size: 3rem;
|
|
20
20
|
font-weight: 600;
|
|
21
21
|
line-height: 1.2;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
:local(.description) {
|
|
25
25
|
margin: 0;
|
|
26
|
-
color:
|
|
26
|
+
color: var(--ig-gray-900);
|
|
27
27
|
font-size: 1.125rem;
|
|
28
28
|
line-height: 1.5;
|
|
29
29
|
}
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
align-items: center;
|
|
51
51
|
min-height: 64px;
|
|
52
52
|
padding: 6px 0;
|
|
53
|
-
color:
|
|
53
|
+
color: var(--ig-gray-700);
|
|
54
54
|
text-align: left;
|
|
55
55
|
text-decoration: none;
|
|
56
56
|
}
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
:local(.resourceIcon) {
|
|
63
63
|
flex: 0 0 28px;
|
|
64
64
|
margin-right: 16px;
|
|
65
|
-
color:
|
|
65
|
+
color: var(--ig-primary-500);
|
|
66
66
|
font-size: 28px;
|
|
67
67
|
}
|
|
68
68
|
|
|
@@ -73,12 +73,12 @@
|
|
|
73
73
|
|
|
74
74
|
:local(.resource) strong {
|
|
75
75
|
margin-bottom: 2px;
|
|
76
|
-
color:
|
|
76
|
+
color: var(--ig-secondary-500);
|
|
77
77
|
font-size: 1rem;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
:local(.resource) small {
|
|
81
|
-
color:
|
|
81
|
+
color: var(--ig-gray-900);
|
|
82
82
|
font-size: 0.875rem;
|
|
83
83
|
line-height: 1.4;
|
|
84
84
|
}
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
flex: 0 0 auto;
|
|
12
12
|
height: 56px;
|
|
13
13
|
padding: 0 16px;
|
|
14
|
-
background:
|
|
15
|
-
box-shadow:
|
|
14
|
+
background: var(--ig-primary-500);
|
|
15
|
+
box-shadow: var(--ig-elevation-4);
|
|
16
16
|
box-sizing: border-box;
|
|
17
17
|
position: relative;
|
|
18
18
|
z-index: 10;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
font-size: 1.25rem;
|
|
28
28
|
font-weight: 600;
|
|
29
29
|
line-height: 1;
|
|
30
|
-
color:
|
|
30
|
+
color: var(--ig-primary-500-contrast);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.app__menu-button {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
width: 40px;
|
|
38
38
|
height: 40px;
|
|
39
39
|
padding: 0;
|
|
40
|
-
color:
|
|
40
|
+
color: var(--ig-primary-500-contrast);
|
|
41
41
|
border: 0;
|
|
42
42
|
background: transparent;
|
|
43
43
|
cursor: pointer;
|
|
@@ -61,16 +61,16 @@
|
|
|
61
61
|
|
|
62
62
|
igc-nav-drawer-item::part(base) {
|
|
63
63
|
min-height: 48px;
|
|
64
|
-
color:
|
|
64
|
+
color: var(--ig-gray-900);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
igc-nav-drawer-item[active]::part(base) {
|
|
68
|
-
background:
|
|
69
|
-
color:
|
|
68
|
+
background: var(--ig-primary-100);
|
|
69
|
+
color: var(--ig-primary-500);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
igc-nav-drawer-item[active] igc-icon {
|
|
73
|
-
color:
|
|
73
|
+
color: var(--ig-primary-500);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
.app__content {
|