Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: pin that every chunk-group field reaches rolldown, not just name/test

[._.]/ Adam Eivy3defe2db8670
diff --git a/client/src/test/viteChunkGroups.test.js b/client/src/test/viteChunkGroups.test.js
index 614a56d86e..9feec113b6 100644
--- a/client/src/test/viteChunkGroups.test.js
+++ b/client/src/test/viteChunkGroups.test.js
@@ -4,6 +4,7 @@ import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
import { CHUNK_GROUPS } from '../../vite.chunkGroups.js';
+import viteConfig from '../../vite.config.js';
const CLIENT_DIR = resolve(import.meta.dirname, '../..');
@@ -66,6 +67,27 @@ describe('vite chunk groups', () => {
expect(test.test('/app/node_modules/three/build/three.module.js')).toBe(false);
});
+ // The regression this guards against is one step downstream of the two
+ // above: `vite.config.js` once handed rolldown a narrowed `{ name, test }`
+ // per group, silently dropping every OTHER field — including
+ // `includeDependenciesRecursively`, which is what makes the
+ // `vendor-three-loaders` split above actually take effect at build time
+ // instead of being re-absorbed into `vendor-three` (#8146). The regex-level
+ // tests above would keep passing even if this field were dropped again,
+ // because they only exercise `vite.chunkGroups.js` in isolation.
+ it('passes every CHUNK_GROUPS field through to rolldown, not just name/test', () => {
+ const resolved = viteConfig({ command: 'build', mode: 'production' });
+ const groups = resolved.build.rolldownOptions.output.codeSplitting.groups;
+ expect(groups).toHaveLength(CHUNK_GROUPS.length);
+ CHUNK_GROUPS.forEach(({ packages, ...expected }, i) => {
+ expect(groups[i]).toEqual(expected);
+ });
+ // Pin the specific field the regression dropped: without it, this
+ // assertion is silently vacuous (both sides simply lack the key).
+ const loaders = groups.find((g) => g.name === 'vendor-three-loaders');
+ expect(loaders.includeDependenciesRecursively).toBe(false);
+ });
+
it('keeps package names from bleeding across the separator', () => {
// A declared name must match a whole path segment: `react` must not swallow
// `react-redux`. The trailing separator is what enforces that.