---
title: "Why does a one-line change rename my Vite library chunks? | Proofline"
description: "A chunk's hash covers its code and the names of the chunks it imports, so a library chunk that imports from your entry is renamed whenever the entry changes."
url: https://proofline.sh/learn/rolldown-vite-chunk-hash-churn/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# Why does a one-line change rename my Vite library chunks?

A chunk's hash covers its code and the names of the chunks it imports, so a library chunk that imports from your entry is renamed whenever the entry changes. That matters after a deploy: every renamed chunk is a file that tabs opened earlier can no longer load, and a download that returning visitors cannot take from their cache. Find the import that ties the library to application code and move that shared module into a chunk that changes only with your dependencies.

Deployment failures The Proofline team December 2, 2026 6 min read

This guide covers the cause. For the browser errors that renamed chunks produce in open tabs, and how to recover from them, read [ChunkLoadError and Unexpected token '<' after a deploy](/learn/chunk-load-error-after-deploy/).

## Why a name changes when its code does not

Vite 8 builds with Rolldown, and Vite 7 and earlier with Rollup. Both write content hashes into chunk names so that browsers can cache them for a long time. A chunk that imports another chunk contains that chunk's file name in an import statement, such as `import{t as e}from"./index-Cznof6Uj.js"`. If the imported chunk is renamed, the importing chunk's text changes, so its hash changes too. A rename travels up the import graph.

That is harmless for application chunks that change together anyway. It is costly when a large, stable library chunk imports from the entry chunk, because the entry changes in almost every release.

Two things commonly create that import:

-   **Vite's preload helper.** Every dynamic `import()` in built code goes through a small helper that preloads the imported chunk's dependencies. Rolldown places it in one chunk and the others import it from there. If the entry uses it, the helper often lands in the entry. A library that loads its own parts lazily, as editors load language grammars, then imports from the entry.
-   **A small shared module.** A helper such as `clsx`, or one of your own utility functions, ends up in whichever chunk the bundler finds best. If that chunk holds application code, every library that uses the helper imports from an application chunk.

## The lab

The lab needs Node.js and `vite`, and builds in under a second. A stand-in library loads its grammars on demand, and two routes import it.

```
mkdir chunk-lab && cd chunk-lab && npm init -y >/dev/null && npm pkg set type=module && npm install vite
mkdir -p src node_modules/fake-editor
echo '{"name":"fake-editor","version":"1.0.0","type":"module","main":"index.js"}' > node_modules/fake-editor/package.json
echo 'export const tokens = (t) => t.split(/([{}:,])/);' > node_modules/fake-editor/lang-json.js
echo 'export const tokens = (t) => t.split(/([:-])/);' > node_modules/fake-editor/lang-yaml.js
echo '<!doctype html><html><body><script type="module" src="/src/main.js"></script></body></html>' > index.html
echo 'export const notFoundTitle = "Page not found";' > src/shell.js
echo 'export default {};' > vite.config.js
```

```
// node_modules/fake-editor/index.js
export async function createEditor(language) {
  // Like Monaco, the editor loads each language's grammar on demand.
  const grammar = language === "json" ? await import("./lang-json.js") : await import("./lang-yaml.js");
  return { highlight: (text) => grammar.tokens(text) };
}
```

```
// src/main.js
import { notFoundTitle } from "./shell.js";
document.title = notFoundTitle;
const routes = {
  "/queries": () => import("./queries-page.js"),
  "/settings": () => import("./settings-page.js"),
};
routes[location.pathname]?.().then((page) => page.show());
```

```
// src/queries-page.js
import { createEditor } from "fake-editor";
export const show = async () => (await createEditor("json")).highlight("{}");
```

`src/settings-page.js` is the same with `"yaml"`. Build, change one string in the entry, and build again:

```
npx vite build >/dev/null && ls dist/assets > a.txt
sed -i 's/Page not found/Page not found./' src/shell.js
npx vite build >/dev/null && ls dist/assets > b.txt
diff a.txt b.txt; comm -12 a.txt b.txt | wc -l
```

With Vite 8.4, only 2 of the 6 names survived. The library chunk and both route chunks were renamed along with the entry:

```
< fake-editor-CrEBhz1H.js
< index-Cznof6Uj.js
> fake-editor-qi4oYAT3.js
> index-CWqM19dL.js
< queries-page-DEpEqzSf.js
< settings-page-B2u80O_D.js
> queries-page-CFU9TDQ7.js
> settings-page-DgK7nJf3.js
```

The reason is one line in the library chunk: `import{t as e}from"./index-Cznof6Uj.js"`, the preload helper.

## Move the shared module out of the entry

Rolldown's [code splitting groups](https://rolldown.rs/reference/OutputOptions.codeSplitting) assign modules to named chunks. Rollup's equivalent is [`output.manualChunks`](https://rollupjs.org/configuration-options/#output-manualchunks). Put the preload helper, whose module ID is `\0vite/preload-helper`, into a vendor chunk:

```
// vite.config.js
import { defineConfig } from "vite";
export default defineConfig({
  build: {
    rolldownOptions: {
      output: {
        codeSplitting: {
          // Vite's preload helper runs every dynamic import. Keep it out of the entry.
          groups: [{ name: "vendor", test: /^\0vite\/preload-helper/ }],
        },
      },
    },
  },
});
```

Repeated with this config, the same one-string change renamed only the entry: 6 of 7 names survived, and the library and both routes now import the helper from `vendor`. The new chunk is a seventh file that the entry loads at start, so give the helper to a vendor chunk you already have, next to React or your other dependencies, rather than creating one for it alone.

For your own build, compare two builds that differ in one application string, then search each renamed library chunk for imports of application chunks. Fix each tie at its source: move a shared third-party helper such as `clsx` into the vendor group, and pass application behavior to a library wrapper as an option instead of importing an application module from it. To keep it fixed, a small build plugin can walk each library chunk's imports in `generateBundle` and fail the build when one reaches a chunk that holds application modules.

## A new shared module can add a request

The same splitting rules work in the other direction. A module imported by one route is bundled into that route's chunk. Import it from a second route and the bundler gives it a chunk of its own, shared by both, so each route now loads one more file. If you budget requests per route, that import breaks the budget without any new code.

The lab shows it with a third route, `/reviews`, that imports only the editor, and a helper `src/format.js` that the queries page imports. A script that walks the build manifest (`vite build --manifest`) counted the files each route adds after the start of the page:

```
== format.js imported by the queries page only
src/queries-page.js    2 files: queries-page-vnwGHozp.js fake-editor-CAhXQiUi.js
src/settings-page.js   2 files: settings-page-DA06faNN.js fake-editor-CAhXQiUi.js
== settings page imports it too
src/queries-page.js    3 files: queries-page-DrXc2Mun.js fake-editor-CAhXQiUi.js format-2hi3hs9g.js
src/settings-page.js   3 files: settings-page-D198I2Fc.js fake-editor-CAhXQiUi.js format-2hi3hs9g.js
```

Moving the helper into `src/shell.js`, which the entry already loads, brought both routes back to two files. Put a small helper in a module every importing route already loads, and check `dist/assets` for a new chunk named after your module when a change adds an import between routes. The [Vite build guide](https://vite.dev/guide/build) describes the default chunking these rules come from.

## Where this came from

Proofline found this in its own console and shipped the fix in its production release of 22 November 2026. Two consecutive builds shared only 123 of 507 asset names, and one navigation in a tab opened before a release requested 21 chunks that answered 404. Of 132 library chunks, 80 were renamed by a one-string change, including the Monaco editor chunk, because the editors and diagram libraries imported the preload helper from the entry and the chart library imported `clsx` from a form library's chunk. After the helper and `clsx` moved to the vendor chunk, all 132 kept their names, and about 2 kB moved from the entry to the vendor chunk with no request added. In its production releases of 1 December 2026, two later changes each pushed a route to 42 requests against a budget of 41, one with a new shared module and one by importing an existing module from a second route; moving the helpers into modules the route already loaded brought it back to 41. Proofline reviews GitHub pull requests; new organizations get one calendar month of hosted code review without a cloud connection. [Start a free GitHub review](https://proofline.sh/orgs/plan?offer=free150) · [Eligibility and fair-use terms](/free-code-review/)

## Questions

### Does upgrading a library still rename its chunks?

Yes. A new version changes the library's code, and so does using a different set of its exports. The goal is that application-only releases leave library chunk names alone.

### Should I put every dependency in one vendor chunk?

No. A large vendor chunk loads on every route and changes whenever any dependency does. Keep the always-loaded libraries and the small shared helpers there, and let large, lazily loaded libraries keep their own chunks.

### How do I see which modules a chunk holds?

Build with `--manifest` to see each chunk's imports, or add a plugin that prints each chunk's module IDs in `generateBundle`.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [ChunkLoadError and Unexpected token '<' after a deploy](/learn/chunk-load-error-after-deploy/)
    
    Deployment failures The Proofline team November 20, 2026 5 min read
    
-   ### [Users still see the old version after a deploy: find which cache answered](/learn/old-version-after-deploy/)
    
    Deployment failures The Proofline team November 20, 2026 5 min read
