Skip to content

Commit ba49a5b

Browse files
thephezclaude
andcommitted
perf(dashmint-lab): strip SDK modulepreload + parallelize fonts
Vite auto-injects <link rel="modulepreload"> for every dynamic-import chunk it discovers. For the ~8MB Evo SDK that defeated the previous deferral commit — the browser raced to fetch the SDK in parallel with the entry chunk, blocking FCP. Filter it out via build.modulePreload.resolveDependencies. Also move the Google Fonts URL out of CSS @import (which serializes the font fetch behind the stylesheet parse) and into <link> tags in index.html with preconnect to fonts.googleapis.com / fonts.gstatic.com, so the font fetch parallelizes with the JS download. Together with the prior dynamic-import commit, FCP drops from 5.1s to 2.7s on a localhost preview Lighthouse run. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d89b9f2 commit ba49a5b

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

example-apps/dashmint-lab/index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<title>DashMint Lab — Dash Platform NFTs</title>
8+
<link rel="preconnect" href="https://fonts.googleapis.com" />
9+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
10+
<link
11+
rel="stylesheet"
12+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap"
13+
/>
814
</head>
915
<body>
1016
<div id="root"></div>

example-apps/dashmint-lab/src/styles/globals.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap");
1+
/* Google Fonts (Inter + JetBrains Mono) loaded via <link> in index.html
2+
* with rel="preconnect" so the font fetch parallelizes with JS download
3+
* instead of being serialized behind this stylesheet. */
24
@import "tailwindcss";
35

46
/*

example-apps/dashmint-lab/vite.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ export default defineConfig({
2323
},
2424
},
2525
plugins: [react(), tailwindcss()],
26+
build: {
27+
// Vite auto-injects <link rel="modulepreload"> for every dynamic-import
28+
// chunk it discovers at build time. For the ~8MB Evo SDK + WASM chunk
29+
// this defeats the whole point of dynamic-importing it: the browser
30+
// races to fetch the SDK in parallel with the entry chunk, blocking
31+
// FCP. Strip the SDK preload so it only fetches when SessionContext
32+
// actually triggers the dynamic import.
33+
modulePreload: {
34+
resolveDependencies: (_filename, deps) =>
35+
deps.filter((d) => !d.includes("evo-sdk")),
36+
},
37+
},
2638
test: {
2739
environment: "node",
2840
include: ["test/**/*.test.{ts,tsx}"],

0 commit comments

Comments
 (0)