fix(build): collapse vendor-graph3d into vendor-misc — Super expression hotfix
This commit is contained in:
@@ -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'
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user