diff --git a/src/core/sync/create_manifest_data/index.js b/src/core/sync/create_manifest_data/index.js index 6e97903682f448a9c95a01527530bd0bdb545174..d233d9c10da549f31bb4d4ff48204bb9f9b4a9e9 100644 --- a/src/core/sync/create_manifest_data/index.js +++ b/src/core/sync/create_manifest_data/index.js @@ -222,7 +222,9 @@ function create_routes_and_nodes(cwd, config, fallback) { // We can't use withFileTypes because of a NodeJs bug which returns wrong results // with isDirectory() in case of symlinks: https://github.com/nodejs/node/issues/30646 - const files = fs.readdirSync(dir).map((name) => ({ + // Sorted so route nodes get the same numbers under every runtime: Node + // returns directory entries sorted, Bun returns them in on-disk order. + const files = fs.readdirSync(dir).sort().map((name) => ({ is_dir: fs.statSync(path.join(dir, name)).isDirectory(), name }));