perf(web/icons): per-icon lucide imports via centralised alias
Route all lucide-react icon usage through a single src/icons.ts re-export that imports each icon from its own per-icon module (lucide-react/dist/esm/icons/<name>) instead of the barrel. Bundle-size impact: none (29kB icons chunk unchanged — tree-shaking was already effective with sideEffects:false). Dev-experience win: Vite transforms 247 modules instead of 1848 because the dep optimiser no longer pre-bundles the full lucide barrel — faster cold start and HMR. Ambient d.ts declares the wildcard module so TS accepts per-icon imports; lucide ships .d.ts only for the barrel. Seven icons were renamed upstream and still work through the barrel via aliases (AlertTriangle -> triangle-alert, BarChart3 -> chart-column, CheckCircle -> circle-check-big, Filter -> funnel, PlusCircle -> circle-plus, Sliders -> sliders-vertical, UploadCloud -> cloud-upload, Fingerprint -> fingerprint-pattern). Component call sites stay on the legacy names; the renames live only in icons.ts.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { X, Server, Cpu, FileText, Sparkles, Check } from 'lucide-react';
|
||||
import { X, Server, Cpu, FileText, Sparkles, Check } from '../../icons';
|
||||
import api from '../../utils/api';
|
||||
import { useEscapeKey } from '../../hooks/useEscapeKey';
|
||||
import { useFocusTrap } from '../../hooks/useFocusTrap';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Network, Plus, Power, Trash2, UploadCloud, RefreshCw, Skull } from 'lucide-react';
|
||||
import { Network, Plus, Power, Trash2, UploadCloud, RefreshCw, Skull } from '../../icons';
|
||||
import api from '../../utils/api';
|
||||
import { clearLayout } from '../MazeNET/useMazeLayoutStore';
|
||||
import CreateTopologyWizard from './CreateTopologyWizard';
|
||||
|
||||
Reference in New Issue
Block a user