Skip to content

Commit 48ac290

Browse files
committed
chore(tutorial): avoid Vite web3 chunk cycle
1 parent 103ba02 commit 48ac290

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tutorial/vite.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,30 @@ import { defineConfig } from "vite";
22
import react from "@vitejs/plugin-react";
33
import { VitePluginRadar } from "vite-plugin-radar";
44

5+
// Keep the wallet stack together to avoid Rolldown splitting viem into a runtime cycle.
6+
const web3ChunkPackages = [
7+
"/@coinbase/",
8+
"/@reown/",
9+
"/@safe-global/",
10+
"/@wagmi/",
11+
"/@walletconnect/",
12+
"/ox/",
13+
"/viem/",
14+
"/wagmi/",
15+
];
16+
517
export default defineConfig({
18+
build: {
19+
rolldownOptions: {
20+
output: {
21+
manualChunks(id) {
22+
if (id.includes("node_modules") && web3ChunkPackages.some((packageName) => id.includes(packageName))) {
23+
return "web3";
24+
}
25+
},
26+
},
27+
},
28+
},
629
plugins: [
730
react(),
831
VitePluginRadar({

0 commit comments

Comments
 (0)