[GH-ISSUE #754] Support experimental.outputHashSalt config option and NEXT_HASH_SALT env var #166

Closed
opened 2026-05-06 12:37:49 +02:00 by BreizhHardware · 0 comments

Originally created by @github-actions[bot] on GitHub (Apr 2, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/754

Upstream change

Next.js added experimental.outputHashSalt (config) and NEXT_HASH_SALT (env var) to mix a user-supplied string into content-addressed output hashes for chunks and static assets. When set, all output filenames change without modifying source code — useful for cache-busting after CDN poisoning or across deployments.

When both are set, the values are concatenated: outputHashSalt + NEXT_HASH_SALT.

Commit: github.com/vercel/next.js@3e0158846e
PR: https://github.com/vercel/next.js/pull/91871

What changed upstream

  • New experimental.outputHashSalt option in ExperimentalConfig (validated via zod in config-schema)
  • New NEXT_HASH_SALT env var support
  • Pre-computed as NextConfigComplete.hashSalt = (experimental.outputHashSalt ?? '') + (NEXT_HASH_SALT ?? '')
  • Webpack: forwarded to output.hashSalt and to the next-image-loader (prepends salt to image content before hashing)
  • Turbopack: threaded through ProjectOptions.hashSalt into chunking contexts, uses deterministic_hash_with_salt for single-pass hashing

What vinext needs

vinext uses Vite/Rolldown for bundling, so the implementation path differs:

  1. Config recognition: Recognize experimental.outputHashSalt in the vinext config layer and NEXT_HASH_SALT env var. Compute the effective salt the same way (configSalt + envSalt).
  2. Build output hashing: Investigate how to inject a hash salt into Vite/Rolldown's content-addressed filenames. Rolldown may support output.hashSalt or similar — if not, a custom generateBundle hook could rename outputs.
  3. Static asset hashing: Images and other static assets processed by Vite's asset pipeline would also need the salt mixed in.
  4. Validation: If neither value is set, behavior should be identical to today (no salt, no change).

Priority

Low — this is an advanced deployment escape hatch, not a common user-facing feature. Track for config parity.

Originally created by @github-actions[bot] on GitHub (Apr 2, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/754 ## Upstream change Next.js added `experimental.outputHashSalt` (config) and `NEXT_HASH_SALT` (env var) to mix a user-supplied string into content-addressed output hashes for chunks and static assets. When set, all output filenames change without modifying source code — useful for cache-busting after CDN poisoning or across deployments. When both are set, the values are concatenated: `outputHashSalt + NEXT_HASH_SALT`. **Commit:** https://github.com/vercel/next.js/commit/3e0158846e490509c6a26a4536d33777d9778101 **PR:** https://github.com/vercel/next.js/pull/91871 ## What changed upstream - New `experimental.outputHashSalt` option in `ExperimentalConfig` (validated via zod in config-schema) - New `NEXT_HASH_SALT` env var support - Pre-computed as `NextConfigComplete.hashSalt = (experimental.outputHashSalt ?? '') + (NEXT_HASH_SALT ?? '')` - **Webpack:** forwarded to `output.hashSalt` and to the `next-image-loader` (prepends salt to image content before hashing) - **Turbopack:** threaded through `ProjectOptions.hashSalt` into chunking contexts, uses `deterministic_hash_with_salt` for single-pass hashing ## What vinext needs vinext uses Vite/Rolldown for bundling, so the implementation path differs: 1. **Config recognition:** Recognize `experimental.outputHashSalt` in the vinext config layer and `NEXT_HASH_SALT` env var. Compute the effective salt the same way (`configSalt + envSalt`). 2. **Build output hashing:** Investigate how to inject a hash salt into Vite/Rolldown's content-addressed filenames. Rolldown may support `output.hashSalt` or similar — if not, a custom `generateBundle` hook could rename outputs. 3. **Static asset hashing:** Images and other static assets processed by Vite's asset pipeline would also need the salt mixed in. 4. **Validation:** If neither value is set, behavior should be identical to today (no salt, no change). ## Priority Low — this is an advanced deployment escape hatch, not a common user-facing feature. Track for config parity.
BreizhHardware 2026-05-06 12:37:49 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#166
No description provided.