fix(stage-ui): configure Histoire to exclude node_modules from vendor chunking

This commit is contained in:
RainbowBird
2026-04-25 16:46:08 +08:00
parent 2b125d5fff
commit bc030812d3
+13
View File
@@ -71,6 +71,19 @@ export default defineConfig({
plugins: [
HstVue(),
],
// NOTICE:
// Histoire force-overrides `vite.build.rollupOptions.output.manualChunks` to lump every
// `node_modules` module into a single `vendor-*.js`. On this project that produces a
// 28+ MiB chunk that breaks Cloudflare Workers' 25 MiB per-asset limit.
//
// Source: node_modules/histoire/dist/node/build.js:122-132 (manualChunks() => 'vendor').
// Escape hatch: histoire whitelists `build.excludeFromVendorsChunk` against every id
// before assigning 'vendor', so matched modules fall back to Rollup's default graph
// chunking. We exclude all `node_modules` so chunks are sized by import graph instead
// of one mega vendor — no per-dep maintenance needed.
build: {
excludeFromVendorsChunk: [/\/node_modules\//],
},
vite: {
base: '/ui/',
plugins: [