Skip to content

Commit 21d37ef

Browse files
committed
fix(ssr): dedupe preload bundles
1 parent 92eb950 commit 21d37ef

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

packages/qwik/src/server/preload-strategy.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,21 @@ import type { RenderToStringOptions } from './types';
88

99
const getBundles = (qrls: QRLInternal[]) => {
1010
const platform = getPlatform();
11-
return qrls
12-
?.map((qrl) => {
13-
const symbol = qrl.$symbol$;
14-
const chunk = qrl.$chunk$;
15-
const result = platform.chunkForSymbol(symbol, chunk, qrl.dev?.file);
16-
if (result) {
17-
return result[1];
18-
}
19-
return chunk;
20-
})
21-
.filter(Boolean) as string[];
11+
return [
12+
...new Set(
13+
qrls
14+
?.map((qrl) => {
15+
const symbol = qrl.$symbol$;
16+
const chunk = qrl.$chunk$;
17+
const result = platform.chunkForSymbol(symbol, chunk, qrl.dev?.file);
18+
if (result) {
19+
return result[1];
20+
}
21+
return chunk;
22+
})
23+
.filter(Boolean) as string[]
24+
),
25+
];
2226
};
2327
/** Returns paths to preload relative to the buildBase, with probabilities */
2428
export function getPreloadPaths(

0 commit comments

Comments
 (0)