Skip to content

Commit 1664165

Browse files
fix(performance): lazy loading, dns-prefetch, and vendor chunk splitting
- Add loading="lazy" to img in TokenLogo and Avatar - Add dns-prefetch for common blockchain RPC endpoints - Add manualChunks to split vendor libs into separate cached chunks
1 parent b84e168 commit 1664165

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png" />
3232
<meta name="apple-mobile-web-app-title" content="dAppBooster" />
3333
<link crossorigin="use-credentials" href="/favicon/site.webmanifest" rel="manifest" />
34+
<!-- DNS prefetch for blockchain RPC endpoints -->
35+
<link rel="dns-prefetch" href="https://eth.llamarpc.com" />
36+
<link rel="dns-prefetch" href="https://cloudflare-eth.com" />
37+
<link rel="dns-prefetch" href="https://gateway.tenderly.co" />
3438
<!-- Fonts -->
3539
<link rel="preconnect" href="https://fonts.googleapis.com" />
3640
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />

src/components/sharedComponents/Avatar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ const Avatar: FC<AvatarProps> = ({
5454
<img
5555
alt={ensName ?? address}
5656
height="100%"
57+
loading="lazy"
5758
src={ensImage}
5859
width="100%"
5960
/>

src/components/sharedComponents/TokenLogo.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const TokenLogo: FC<TokenLogoProps> = ({ size = 24, token }) => {
101101
<img
102102
alt={token.name}
103103
height={`${size}`}
104+
loading="lazy"
104105
onError={() => setHasError(true)}
105106
src={getSrc(logoURI)}
106107
width={`${size}`}

vite.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ export default defineConfig({
1717
hostname: 'https://dappbooster.dev',
1818
}),
1919
],
20+
build: {
21+
rollupOptions: {
22+
output: {
23+
manualChunks: {
24+
'vendor-react': ['react', 'react-dom'],
25+
'vendor-wagmi': ['wagmi', 'viem'],
26+
'vendor-tanstack': ['@tanstack/react-query', '@tanstack/react-router'],
27+
'vendor-chakra': ['@chakra-ui/react'],
28+
'vendor-web3': ['@reown/appkit', '@reown/appkit-adapter-wagmi'],
29+
},
30+
},
31+
},
32+
},
2033
envPrefix: 'PUBLIC_',
2134
resolve: {
2235
alias: {

0 commit comments

Comments
 (0)