diff --git a/src/node/build/bundle.ts b/src/node/build/bundle.ts index 6eee911d..bb9c4a72 100644 --- a/src/node/build/bundle.ts +++ b/src/node/build/bundle.ts @@ -43,7 +43,7 @@ export async function bundle( serverResult: Rollup.RollupOutput pageToHashMap: Record }> { - const pageToHashMap = Object.create(null) + const pageToHashMap = Object.create(null) as Record 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 + Object.keys(pageToHashMap) + .sort() + .forEach((key) => { + sortedPageToHashMap[key] = pageToHashMap[key] + }) + + return { clientResult, serverResult, pageToHashMap: sortedPageToHashMap } } const cache = new Map()