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 flag | Value / default | Applies to | Source |
|---|---|---|---|
output.filename | '[name].[contenthash].js' as the guide’s filename template | webpack 5.113.0 / current guide | caching |
optimization.runtimeChunk | 'single' shares extracted runtime; default false embeds runtime in entries | webpack 5.113.0 / current docs | optimization |
optimization.moduleIds | 'deterministic'; already the production default | webpack 5.113.0 / current docs | optimization |
optimization.chunkIds | 'deterministic'; already the production default | webpack 5.113.0 / current docs | optimization |
optimization.splitChunks.cacheGroups | For an intentional vendor group use test: /[\\/]node_modules[\\/]/, name: 'vendors', chunks: 'all' | webpack 5.113.0 / current guide | caching |
optimization.realContentHash | true, production default; hashes processed asset content | webpack 5.113.0 / current docs | optimization |
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) | Cause | Fix | Source |
|---|---|---|---|
Vendor chunkhash changes when app code changes | The historical report says vendor chunkhash changes when app code changes | Use the current contenthash/runtime/ID approach; inspect emitted bytes instead of copying old webpack plugin recipes | kevinrenskers, July 30, 2015, caching |
| Content hash uses internal data | realContentHash: false can hash internal data instead of final bytes | Retain realContentHash; it is enabled in production mode; keep salt and inputs fixed | optimization, 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