igniteui-cli 14.10.0-alpha.2 → 14.10.0-alpha.4
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/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/SKILL.md +161 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/CHARTS-GRIDS.md +127 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/COMPONENT-CATALOGUE.md +301 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/EVENT-HANDLING.md +70 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/INSTALLATION.md +139 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/JSX-PATTERNS.md +187 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/REFS-FORMS.md +229 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/REVEAL-SDK.md +198 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-components/reference/TROUBLESHOOTING.md +147 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/SKILL.md +182 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/CSS-THEMING.md +265 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/MCP-SERVER.md +75 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/REVEAL-THEME.md +86 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/SASS-THEMING.md +125 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-customize-theme/reference/TROUBLESHOOTING.md +35 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__claude/skills/igniteui-react-optimize-bundle-size/SKILL.md +439 -0
- package/templates/react/igr-ts/projects/_base/files/__dot__vscode/mcp.json +2 -2
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-choose-components/SKILL.md +358 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-customize-component-theme/SKILL.md +615 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/SKILL.md +112 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/angular.md +185 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/react.md +116 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/vanilla-js.md +118 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-integrate-with-framework/references/vue.md +181 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__claude/skills/igniteui-wc-optimize-bundle-size/SKILL.md +709 -0
- package/templates/webcomponents/igc-ts/projects/_base/files/__dot__vscode/mcp.json +2 -2
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: igniteui-react-optimize-bundle-size
|
|
3
|
+
description: This skill optimizes application bundle size when using Ignite UI for React and should be used when the bundle is too large, when setting up tree-shaking, or when lazy loading heavy components like grids and charts
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Optimize Bundle Size
|
|
8
|
+
|
|
9
|
+
This skill helps users minimize their React application's bundle size when using Ignite UI for React by importing only the components they need, leveraging tree-shaking, and applying lazy loading strategies.
|
|
10
|
+
|
|
11
|
+
## Example Usage
|
|
12
|
+
|
|
13
|
+
- "My bundle size is too large"
|
|
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?"
|
|
19
|
+
|
|
20
|
+
## Related Skills
|
|
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… |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `igniteui-react` | Buttons, inputs, dialogs, calendars, lists, etc. | Core UI components |
|
|
52
|
+
| `igniteui-react` + `igniteui-grid-lite` | Lightweight grid (`IgrGridLite` from `igniteui-react/grid-lite`) | Simple tabular data (MIT, requires both packages) |
|
|
53
|
+
| `igniteui-react-grids` | DataGrid, TreeGrid, PivotGrid, HierarchicalGrid | Advanced data grids (commercial) |
|
|
54
|
+
| `igniteui-react-charts` | Category, Pie, Financial, Scatter charts | Charts and data visualization (commercial) |
|
|
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`
|
|
104
|
+
|
|
105
|
+
Code-split heavy components behind lazy imports to reduce initial bundle size.
|
|
106
|
+
|
|
107
|
+
### Lazy Loading a Single Component
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import { lazy, Suspense, useState } from 'react';
|
|
111
|
+
|
|
112
|
+
// Lazy load the dialog component
|
|
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
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Lazy Loading a Heavy Page Component
|
|
136
|
+
|
|
137
|
+
This is the recommended approach for code-splitting: wrap entire page components that use heavy Ignite UI components.
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
// App.tsx
|
|
141
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
142
|
+
import { lazy, Suspense } from 'react';
|
|
143
|
+
|
|
144
|
+
const HomePage = lazy(() => import('./pages/Home'));
|
|
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
|
+
```
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
// pages/Dashboard.tsx — only loaded when navigating to /dashboard
|
|
165
|
+
import { IgrGrid, IgrColumn } from 'igniteui-react-grids';
|
|
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
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
// pages/Analytics.tsx — only loaded when navigating to /analytics
|
|
180
|
+
import { IgrCategoryChart, IgrCategoryChartModule } from 'igniteui-react-charts';
|
|
181
|
+
|
|
182
|
+
IgrCategoryChartModule.register();
|
|
183
|
+
|
|
184
|
+
export default function Analytics() {
|
|
185
|
+
return <IgrCategoryChart dataSource={data} width="100%" height="500px" />;
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Result:** The grid and chart bundles are only downloaded when the user navigates to those routes.
|
|
190
|
+
|
|
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
|
|
202
|
+
// vite.config.ts
|
|
203
|
+
import { defineConfig } from 'vite';
|
|
204
|
+
import react from '@vitejs/plugin-react';
|
|
205
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
206
|
+
|
|
207
|
+
export default defineConfig({
|
|
208
|
+
plugins: [
|
|
209
|
+
react(),
|
|
210
|
+
visualizer({
|
|
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
|
+
}
|
|
358
|
+
},
|
|
359
|
+
minimize: true,
|
|
360
|
+
},
|
|
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
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
### Issue: Tree-shaking not working
|
|
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:
|
|
410
|
+
|
|
411
|
+
```json
|
|
412
|
+
// tsconfig.json
|
|
413
|
+
{
|
|
414
|
+
"compilerOptions": {
|
|
415
|
+
"module": "esnext",
|
|
416
|
+
"moduleResolution": "bundler"
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Expected Results
|
|
424
|
+
|
|
425
|
+
After optimization, you should see:
|
|
426
|
+
|
|
427
|
+
- **Initial load time reduced** by 40–60%
|
|
428
|
+
- **Bundle size reduced** by 50–80% (compared to importing everything)
|
|
429
|
+
- **Better Core Web Vitals** scores
|
|
430
|
+
- **Faster time to interactive**
|
|
431
|
+
- **Lower bandwidth usage** for users
|
|
432
|
+
|
|
433
|
+
## Additional Resources
|
|
434
|
+
|
|
435
|
+
- [Vite Build Optimizations](https://vitejs.dev/guide/build.html)
|
|
436
|
+
- [React.lazy Documentation](https://react.dev/reference/react/lazy)
|
|
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/)
|