fix(build): collapse vendor-graph3d into vendor-misc — Super expression hotfix
This commit is contained in:
@@ -129,21 +129,19 @@ export default defineConfig({
|
|||||||
// Axios + парсеры
|
// Axios + парсеры
|
||||||
if (id.match(/node_modules\/(axios|jose|crypto-js)\//)) return 'vendor-net'
|
if (id.match(/node_modules\/(axios|jose|crypto-js)\//)) return 'vendor-net'
|
||||||
|
|
||||||
// 3D-graph (three.js + react-force-graph-3d + transitive deps).
|
// HOTFIX: graph3d isolated chunk был причиной runtime "Super
|
||||||
// Изолирован в свой chunk, чтобы НЕ попасть в vendor-misc, который
|
// expression must either be null or a function" (cyclic chunk
|
||||||
// загружается eagerly. DictionaryGraph3D импортируется через
|
// dependency vendor-misc ↔ vendor-graph3d ломает порядок
|
||||||
// React.lazy() — Rollup auto-defers этот chunk до первого
|
// initialization three.js class inheritance). Откатываем
|
||||||
// дин-импорта. ~500kb gzipped (~600kb three.js + force graph
|
// isolation — three.js + d3-shared идут в общий vendor-misc.
|
||||||
// wrappers), грузится только при переключении в 3D режим.
|
//
|
||||||
if (
|
// Trade-off: vendor-misc вырастет до ~700kb gz (с three.js),
|
||||||
id.match(
|
// default page load грузит three.js eager. Lazy advantage 3D
|
||||||
/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)/,
|
// mode потерян. Это acceptable hotfix чтобы вернуть сайт; clean
|
||||||
)
|
// chunk split с separate worker bundle / preload strategy —
|
||||||
) {
|
// separate follow-up. См. также: React.lazy на DictionaryGraph3D
|
||||||
return 'vendor-graph3d'
|
// остаётся валидным (component split), просто его vendor deps
|
||||||
}
|
// теперь в общем chunk.
|
||||||
|
|
||||||
// Остальное — в общий vendor (не должно быть много)
|
|
||||||
return 'vendor-misc'
|
return 'vendor-misc'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user