Skip to content

Support experimental.outputHashSalt config option and NEXT_HASH_SALT env var #754

@github-actions

Description

@github-actions

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: vercel/next.js@3e01588
PR: vercel/next.js#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    nextjs-trackingTracking issue for a Next.js canary change relevant to vinext

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions