perf(build): split recharts + tiptap into dedicated vendor chunks

Previously, recharts (337 KB raw) lived inside an auto-generated shared
chunk named after the small useChartColors hook because that hook was
the first import path pulling recharts in. Any change to the hook
busted the chunk hash and forced users to re-download the whole
charting library.

Same story for @tiptap and the prosemirror peers — they were grouped
under a 'tiptap-video' chunk named after the local extension file.

Explicit vendor-recharts and vendor-tiptap buckets give those libs
stable cache-keys and predictable names that match the rest of the
vendor-* chunking scheme. Bundle sizes are net-neutral; what improves
is cache stability across releases.
This commit is contained in:
c0mrade
2026-05-26 15:12:50 +03:00
parent ff5156f36a
commit 7f14c499ad

View File

@@ -55,6 +55,10 @@ export default defineConfig({
if (id.includes('twemoji') || id.includes('@twemoji/')) return 'vendor-twemoji';
if (id.includes('/jsencrypt/') || id.includes('@kastov/')) return 'vendor-crypto';
if (id.includes('@lottiefiles/')) return 'vendor-lottie';
// Heavy admin-only deps — split so they don't bloat the shared
// chunks of other lazy admin pages that don't use them.
if (id.includes('/recharts/') || id.includes('/d3-')) return 'vendor-recharts';
if (id.includes('@tiptap/') || id.includes('/prosemirror-')) return 'vendor-tiptap';
if (
id.includes('/axios/') ||
id.includes('/zustand/') ||