Skip to content

Commit 3d55f4d

Browse files
committed
fix: handle situation where there are no initial scripts
1 parent d01cf4e commit 3d55f4d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/renderer.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ export function renderPrefetchLinks (ssrContext: SSRContext, renderContext: Rend
138138
export function renderScripts (ssrContext: SSRContext, renderContext: RenderContext): string {
139139
if (renderContext.clientManifest && renderContext.preloadFiles) {
140140
const initial = renderContext.preloadFiles.filter(({ file }) => isJS(file))
141+
if (!initial.length) {
142+
return ''
143+
}
141144
const async = (getUsedAsyncFiles(ssrContext, renderContext) || []).filter(({ file }) => isJS(file))
142145
const needed = [initial[0]].concat(async, initial.slice(1))
143146
return needed.map(({ file }) => {

0 commit comments

Comments
 (0)