From 99d5d5d84412ea48d468210e5d4d2f4a11814c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B8=D0=BC=D0=B8=D0=BD?= Date: Mon, 11 May 2026 23:53:55 +0000 Subject: [PATCH] =?UTF-8?q?fix(build):=20collapse=20vendor-graph3d=20into?= =?UTF-8?q?=20vendor-misc=20=E2=80=94=20Super=20expression=20hotfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ordinis-admin-ui/vite.config.ts | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/ordinis-admin-ui/vite.config.ts b/ordinis-admin-ui/vite.config.ts index a90e75a..39c57f2 100644 --- a/ordinis-admin-ui/vite.config.ts +++ b/ordinis-admin-ui/vite.config.ts @@ -129,21 +129,19 @@ export default defineConfig({ // Axios + парсеры if (id.match(/node_modules\/(axios|jose|crypto-js)\//)) return 'vendor-net' - // 3D-graph (three.js + react-force-graph-3d + transitive deps). - // Изолирован в свой chunk, чтобы НЕ попасть в vendor-misc, который - // загружается eagerly. DictionaryGraph3D импортируется через - // React.lazy() — Rollup auto-defers этот chunk до первого - // дин-импорта. ~500kb gzipped (~600kb three.js + force graph - // wrappers), грузится только при переключении в 3D режим. - if ( - id.match( - /node_modules\/(three|3d-force-graph|d3-force-3d|d3-binarytree|d3-octree|kapsule|react-kapsule|three-forcegraph|three-render-objects|react-force-graph-3d|@tweenjs|accessor-fn|index-array-by)/, - ) - ) { - return 'vendor-graph3d' - } - - // Остальное — в общий vendor (не должно быть много) + // HOTFIX: graph3d isolated chunk был причиной runtime "Super + // expression must either be null or a function" (cyclic chunk + // dependency vendor-misc ↔ vendor-graph3d ломает порядок + // initialization three.js class inheritance). Откатываем + // isolation — three.js + d3-shared идут в общий vendor-misc. + // + // Trade-off: vendor-misc вырастет до ~700kb gz (с three.js), + // default page load грузит three.js eager. Lazy advantage 3D + // mode потерян. Это acceptable hotfix чтобы вернуть сайт; clean + // chunk split с separate worker bundle / preload strategy — + // separate follow-up. См. также: React.lazy на DictionaryGraph3D + // остаётся валидным (component split), просто его vendor deps + // теперь в общем chunk. return 'vendor-misc' }, },