#36136·nuxt

`_nuxt/*` chunk `[hash]` not unique across builds — cached copy collides with newer content

Author: surgiieCreated Aug 21, 2026Updated Sep 27, 2026
Labelspending triage🔨 p3-minorpossible regression

Environment

●  Nuxt root directory: /home/surgiie/projects/nuxt-hash-issue
│
│ ╭── Nuxt project info (copied to clipboard) ─────────────────────────────╮
│ │                                                                        │
│ │  Operating system      Linux 6.18.44                                   │
│ │  CPU                   Intel(R) Core(TM) Ultra 5 125H (18 cores)       │
│ │  Node.js version       v24.19.0                                        │
│ │  nuxt/cli version      3.37.0                                          │
│ │  Package manager       npm 11.17.0                                     │
│ │  Nuxt version          4.5.2                                           │
│ │  Nitro version         2.13.4                                          │
│ │  Builder               vite 8.2.2                                      │
│ │  Config                compatibilityDate, devtools, hooks, nitro, ssr  │
│ │  Modules               -                                               │
│ │                                                                        │
│ ╰────────────────────────────────────────────────────────────────────────╯
│

Reproduction

https://github.com/surgiie/nuxt-hash-issue

Refer to the readme for full instructions.

Describe the bug

Two builds of the same Nuxt app can emit a shared JS chunk under the same _nuxt/<hash>.js filename with genuinely different content. This is problematic for applications that do all of the following:

  • Add subresource integrity attributes to script tags that load _nuxt/<hash>.js files.
  • Cache these _nuxt/* files with long cache ages via the Cache-Control header.

When serving an app in this fashion, a browser can end up with a cached file whose content no longer matches the integrity hash the current page expects — producing a hard browser failure like:

Failed to find a valid digest in the 'integrity' attribute for resource
'.../_nuxt/<name>.js' with computed SHA-256 integrity '...'.
The resource has been blocked.

Visually, Nuxt's error page renders something like:

500
Internal Server Error
Failed to fetch dynamically imported module: http://localhost:4173/_nuxt/<hash>.js

Additional context

Workarounds & Findings

It's unclear to me whether this is fully deterministic (same inputs always collide) — confirming that would take a lot more testing than I'd like to put in right now. Some assistance/guidance figuring out a cleaner fix or workaround would be appreciated. What I've tried or considered so far:

  • Widening the chunk hash (build.rolldownOptions.output.chunkFileNames / entryFileNames, e.g. _nuxt/[name]-[hash:21].js) — with some help from an LLM, I noticed this produces more consistent results in my testing, but I'm not entirely sure it fully eliminates the possibility of this happening. I'd guess a collision is still possible.
  • Setting entryImportMap: false seems to mitigate the issue as hinted by others in #33247
  • Dropping SRI/integrity attributes entirely and not caching assets — would remove the hard failure mode I'm seeing, but I'd rather not go this route: it's a real security control to give up, and it doesn't fix the actual bug — the wrong bytes would still silently end up served at a filename other code/caches trust, just without anything catching it.
  • Cache Invalidations - Possible but not ideal for us when paired with large amount of builds and defeats the purpose of hash file names.

Expectations

Changing the codebase should produce consistent hash names, so that a site can rely on the filename itself to know when it needs to request a new asset file. If there's a known-good mitigation, or this is already understood/fixed upstream in a way I'm missing, I'd appreciate a pointer.

Logs

shell-script
The reproduction repository provides util script commands for producing visual output showcasing the problem that include which file has differing content between builds but the same `[hash]` filename. There are no relevant logs produced by nuxt when reproducing this or worth sharing.

Related

I believe the following issue maybe related or very similar