Skip to content

Commit e302328

Browse files
committed
fix(build): sort pageToHashMap to ensure stable assets
closes #4016
1 parent f3ee906 commit e302328

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/node/build/bundle.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function bundle(
4343
serverResult: Rollup.RollupOutput
4444
pageToHashMap: Record<string, string>
4545
}> {
46-
const pageToHashMap = Object.create(null)
46+
const pageToHashMap = Object.create(null) as Record<string, string>
4747
const clientJSMap = Object.create(null)
4848

4949
// define custom rollup input
@@ -202,7 +202,15 @@ export async function bundle(
202202
}
203203
}
204204

205-
return { clientResult, serverResult, pageToHashMap }
205+
// sort pageToHashMap to ensure stable output
206+
const sortedPageToHashMap = Object.create(null) as Record<string, string>
207+
Object.keys(pageToHashMap)
208+
.sort()
209+
.forEach((key) => {
210+
sortedPageToHashMap[key] = pageToHashMap[key]
211+
})
212+
213+
return { clientResult, serverResult, pageToHashMap: sortedPageToHashMap }
206214
}
207215

208216
const cache = new Map<string, boolean>()

0 commit comments

Comments
 (0)