Skip to content

Commit dcb50b3

Browse files
amir-zahediclaudeCopilot
authored
feat(gdu): add manualChunks for mfe-configs chunk naming (#400)
* feat(gdu): add manualChunks to Vite config for mfe-configs chunk naming Route all packages/global-configs modules into a mfe-configs named chunk, mirroring webpack's splitChunks convention. Ensures CI tokenReplacement.sh can find and replace #{...} config tokens in Vite/Rolldown builds, fixing WebSocket subscription failures from unreplaced tokens. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: Applies formatting * Update packages/gdu/config/vite/types.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/gdu/config/vite/vite.config.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 79be5ec commit dcb50b3

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"gdu": minor
3+
---
4+
5+
feat(gdu): add manualChunks to Vite config for mfe-configs chunk naming
6+
7+
Routes all `packages/global-configs` modules into a `mfe-configs` named chunk, mirroring webpack's `splitChunks.cacheGroups.mfeConfigs` convention. This ensures CI token replacement (`tokenReplacement.sh`) can find and replace `#{...}` config tokens in Vite/Rolldown builds, fixing WebSocket subscription failures caused by unreplaced tokens in arbitrarily-named chunks.

packages/gdu/config/vite/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ export interface RolldownOutputOptions {
1313
chunkFileNames?: string;
1414
assetFileNames?: string;
1515
paths?: Record<string, string>;
16+
manualChunks?: (
17+
id: string,
18+
meta: { getModuleInfo: (id: string) => unknown },
19+
) => string | void;
1620
}
1721

1822
export interface RolldownOutputChunk {

packages/gdu/config/vite/vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ export const baseViteOptions = ({
128128
chunkFileNames: 'chunks/[name]-[hash:8].js',
129129
assetFileNames: '[name]-[hash:8][extname]',
130130
...(externalKeys.length > 0 ? { paths: externalsMap } : {}),
131+
manualChunks(id) {
132+
const normalizedId = id.replace(/\\/g, '/');
133+
if (normalizedId.includes('packages/global-configs')) {
134+
return 'mfe-configs';
135+
}
136+
return null;
137+
},
131138
},
132139
},
133140
},

0 commit comments

Comments
 (0)