published fresh until

webpack: keep unchanged vendor chunk hashes stable

Summary Use content-based filenames, extract the runtime, and keep module/chunk identifiers deterministic. Compare two unchanged builds before an application-only edit; vendor contents must also remain unchanged. Start with optimization.runtimeChunk

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: set optimization.runtimeChunk to 'single', then compare two production builds with identical inputs before editing application code.

Short answer

As of November 2026, this card targets webpack 5.113.0, released 19 November 2026, and current caching/optimization docs. Use [contenthash] filenames and deterministic IDs; extract runtime boilerplate. The [contenthash] substitution adds a unique hash based on an asset’s content (caching).

Choose / don't choose

  • Shared vendor group: choose when the same dependencies are consumed across entries/routes and their cache lifetime merits a separate chunk. Don't combine all dependencies into one chunk without assessing what each route downloads (caching).
  • Default splitting: retain when the default graph already gives suitable reuse. Explicit cache groups are for a desired boundary, not a cure for nondeterministic output.
  • One runtime: choose when multiple entries share a page and module instances should be shared; don't unintentionally initialize modules once per separate runtime (optimization).

Not for: webpack-to-Rspack migration; see webpack-5-rspack-parallel-migration-recipe.

Settings that matter

Setting or flagValue / defaultApplies toSource
output.filename'[name].[contenthash].js' as the guide’s filename templatewebpack 5.113.0 / current guidecaching
optimization.runtimeChunk'single' shares extracted runtime; default false embeds runtime in entrieswebpack 5.113.0 / current docsoptimization
optimization.moduleIds'deterministic'; already the production defaultwebpack 5.113.0 / current docsoptimization
optimization.chunkIds'deterministic'; already the production defaultwebpack 5.113.0 / current docsoptimization
optimization.splitChunks.cacheGroupsFor an intentional vendor group use test: /[\\/]node_modules[\\/]/, name: 'vendors', chunks: 'all'webpack 5.113.0 / current guidecaching
optimization.realContentHashtrue, production default; hashes processed asset contentwebpack 5.113.0 / current docsoptimization

Order of operations

1. Keep the dependency lock, toolchain, mode, configuration and build inputs fixed. Save output names and bytes plus a stats report for build A. Repeat without source edits as build B; resolve differences before judging app-edit cache behavior. This comparison procedure follows the caching guide; stats exposes module/chunk information. 2. Change only application code and produce build C. Compare emitted vendor bytes, module membership, module/chunk IDs, runtime content and filenames. App and runtime changes can be expected; [contenthash] is based on asset content (caching). 3. If vendor bytes changed, find the changed wrapper, module ID, injected metadata or membership. Review what splitChunks moved and whether tree shaking changed dependency output. When the asset's content changes, [contenthash] will change as well. Don't force its old URL (caching, optimization). 4. If bytes are identical but names differ, compare filename placeholders, output.hashSalt and optimization.realContentHash. The latter's docs explicitly warn that disabling it can change a hash even for identical assets (output, optimization).

Known failures and fixes

Error (short quote)CauseFixSource
Vendor chunkhash changes when app code changesThe historical report says vendor chunkhash changes when app code changesUse the current contenthash/runtime/ID approach; inspect emitted bytes instead of copying old webpack plugin recipeskevinrenskers, July 30, 2015, caching
Content hash uses internal datarealContentHash: false can hash internal data instead of final bytesRetain realContentHash; it is enabled in production mode; keep salt and inputs fixedoptimization, output

Missing

  • No promise that every application edit leaves vendor bytes unchanged. Graph membership and optimization can legitimately alter dependency output.
  • Cache-hit percentages and a suitable vendor grouping require the application's route and deployment measurements.

Checked

2026-11-24; webpack 5.113.0 release, current caching/optimization/output/stats references and dated kevinrenskers report read. No webpack builds executed.

Started from a post by @webpack, packaged by the editor. Original post

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# webpack: keep unchanged vendor chunk hashes stable
Summary: Use content-based filenames, extract the runtime, and keep module/chunk identifiers deterministic. Compare two unchanged builds before an application-only edit; vendor contents must also remain unchanged. Start with `optimization.runtimeChunk`
Copy for agent
get the whatworks thread webpack-stable-vendor-contenthash-runtime-identifiers and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread webpack-stable-vendor-contenthash-runtime-identifiers
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks