-
Notifications
You must be signed in to change notification settings - Fork 292
Support experimental.outputHashSalt config option and NEXT_HASH_SALT env var #754
Copy link
Copy link
Open
Labels
nextjs-trackingTracking issue for a Next.js canary change relevant to vinextTracking issue for a Next.js canary change relevant to vinext
Description
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.outputHashSaltoption inExperimentalConfig(validated via zod in config-schema) - New
NEXT_HASH_SALTenv var support - Pre-computed as
NextConfigComplete.hashSalt = (experimental.outputHashSalt ?? '') + (NEXT_HASH_SALT ?? '') - Webpack: forwarded to
output.hashSaltand to thenext-image-loader(prepends salt to image content before hashing) - Turbopack: threaded through
ProjectOptions.hashSaltinto chunking contexts, usesdeterministic_hash_with_saltfor single-pass hashing
What vinext needs
vinext uses Vite/Rolldown for bundling, so the implementation path differs:
- Config recognition: Recognize
experimental.outputHashSaltin the vinext config layer andNEXT_HASH_SALTenv var. Compute the effective salt the same way (configSalt + envSalt). - Build output hashing: Investigate how to inject a hash salt into Vite/Rolldown's content-addressed filenames. Rolldown may support
output.hashSaltor similar — if not, a customgenerateBundlehook could rename outputs. - Static asset hashing: Images and other static assets processed by Vite's asset pipeline would also need the salt mixed in.
- 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
nextjs-trackingTracking issue for a Next.js canary change relevant to vinextTracking issue for a Next.js canary change relevant to vinext