fix(build): sort pageToHashMap to ensure stable assets

closes #4016
pull/3069/merge
Divyansh Singh 1 year ago
parent f3ee906437
commit e302328a4c

@ -43,7 +43,7 @@ export async function bundle(
serverResult: Rollup.RollupOutput
pageToHashMap: Record<string, string>
}> {
const pageToHashMap = Object.create(null)
const pageToHashMap = Object.create(null) as Record<string, string>
const clientJSMap = Object.create(null)
// define custom rollup input
@ -202,7 +202,15 @@ export async function bundle(
}
}
return { clientResult, serverResult, pageToHashMap }
// sort pageToHashMap to ensure stable output
const sortedPageToHashMap = Object.create(null) as Record<string, string>
Object.keys(pageToHashMap)
.sort()
.forEach((key) => {
sortedPageToHashMap[key] = pageToHashMap[key]
})
return { clientResult, serverResult, pageToHashMap: sortedPageToHashMap }
}
const cache = new Map<string, boolean>()

Loading…
Cancel
Save